<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>





	<title>Storing and Retrieving Images from SQL Server using Microsoft 
.NET - CodeProject</title> 
	<link type="text/css" rel="stylesheet" 
href="ImageSaveInDataBase.aspx_files/CodeProject.css">
<link type="text/css" rel="stylesheet" 
href="ImageSaveInDataBase.aspx_files/ForumClassic.css">
<style type="text/css">
#ATD {position: absolute;top: -90px;left: -5000px;z-index: 200;display: none;white-space:nowrap;background-color:white;padding:10px;border: solid 1px #999;}

</style>


	
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Description" content="Storing and retrieving images from SQL
 Server using Microsoft .NET.; Author: Kazim Sardar Mehdi; Section: 
Database; Chapter: Database">
<meta name="Keywords" content=".NET1.1, SQL2000, VS.NET2003, C#, SQL, 
Windows, DBA, Dev, ADO.NET, Intermediate,Database,Database,Free source 
code, tutorials">
<meta name="Author" content="The Code Project">
<meta name="Rating" content="General">
<meta name="Robots" content="index, follow">
<meta name="Revisit-After" content="1 days">
<link rel="alternate" type="application/rss+xml" title="CodeProject 
Latest articles - All topics" 
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=1">
<link rel="alternate" type="application/rss+xml" title="CodeProject 
Latest articles - MFC / C++" 
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=2">
<link rel="alternate" type="application/rss+xml" title="CodeProject 
Latest articles - C#" 
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=3">
<link rel="alternate" type="application/rss+xml" title="CodeProject 
Latest articles - ASP.NET" 
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=4">
<link rel="alternate" type="application/rss+xml" title="CodeProject 
Latest articles - .NET" 
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=5">
<link rel="alternate" type="application/rss+xml" title="CodeProject 
Latest articles - VB.NET" 
href="http://www.codeproject.com/webservices/articlerss.aspx?cat=6">
<link rel="alternate" type="application/rss+xml" title="CodeProject 
Lounge Postings" 
href="http://www.codeproject.com/webservices/LoungeRSS.aspx">
<link rel="search" type="application/opensearchdescription+xml" 
title="CodeProject" 
href="http://www.codeproject.com/info/OpenSearch.xml">
	<!-- base -->
	<link rel="icon" href="http://www.codeproject.com/favicon.ico" 
type="image/ico">
<link rel="shortcut icon" href="http://www.codeproject.com/favicon.ico" 
type="image/ico">
<script type="text/javascript" language="Javascript" src="ImageSaveInDataBase.aspx_files/rateitem.js"></script>
<script type="text/javascript" language="Javascript">//<![CDATA[
if(top!=self)top.location.href=location.href; if(typeof(DemoUrl)!="undefined")document.write(unescape('%3Cme')+'ta http'+'-equiv="re' +'fresh" con'+'tent="1;url='+DemoUrl+unescape('"%3CE'));
function LK(e) { var lounge  = document.getElementById("ctl00_TopNavBar_Lounge"); var soapbox = document.getElementById("ctl00_TopNavBar_Soapbox"); if (lounge && soapbox) {   lounge.style.display = e.ctrlKey? "none" : "inline";  soapbox.style.display = e.ctrlKey? "inline" : "none"; }}
function LC(e) {
 window.location.href = e.ctrlKey ? '/script/Forums/View.aspx?fid=1536756':'/Lounge.aspx';
 if (document.all) e.returnValue = false; else e.preventDefault();
}
function ToggleMenu(itemName)
{
	var elm = document.getElementById(itemName);
	var i,others = document.getElementById('SectionMenu');
	for(i=0; i < others.childNodes.length; i++)
	{
		var other = others.childNodes[i];
		if ((other.className == 'menu2-dropdown') && (other != elm))
			other.style.display='none';
	}
	if (elm.style.display == 'block') elm.style.display='none';
	else elm.style.display='block';
	return false;
}

var Selected = "-1";
function Pin(elm){
 CloseMsg(Selected);
 var wrk=elm.parentNode; if(wrk)wrk=wrk.firstChild;
 var fc=elm?elm.firstChild:null;
 if (wrk&&!wrk.pinned) {
  OpenMsg(wrk.name, true);wrk.pinned=true;fc.src='/script/forums/images/pinned.gif';fc.title='Pinned. Click to unpin'
 } else {
  wrk.pinned=false;CloseMsg(wrk.name); fc.src='/script/forums/images/pin.gif';fc.title='Click to pin message'
 }
 return false;
}
function CloseMsg(msgId) {
 if(!msgId||(msgId==''))return;
 var lnk=document.getElementsByName(msgId);
 if(lnk&&lnk.length>0&&lnk[0].pinned)return;
 var head=eval("document.getElementById('F" + msgId + "_h0')");
 if(head) head.className = head.className.replace("Sel", "UnSel");
 var body=eval("document.getElementById('F" + msgId + "_h1')");
 if(body) body.style.display = 'none';
}
function OpenMsg(msgId, keep) {
 if(!msgId||(msgId==''))return;
 var body=eval("document.getElementById('F" + msgId + "_h1')");
 if(body){
  var lnk=document.getElementsByName(msgId);
  if(lnk&&lnk.length>0&&lnk[0].pinned)keep=true;
  if(keep&&body.style.display!='none')return;
  if(body.style.display=='none') body.style.display='';
  else body.style.display = 'none';
 }
 var head=eval("document.getElementById('F" + msgId + "_h0')");
 if (head) head.className = head.className.replace('UnSel', 'Sel');
 if(body&&head&&body.style.display!='none'){
  document.body.scrollTop = getRealPos(head, 'Top') - document.body.clientHeight/10;
  EnsureMessageVisible(msgId, true);
 }
}

function SwitchMessage(e, msgId)
{
  if (msgId) msgId=msgId.toString();
  else {
    if(!e)e=window.event;
    var target=e.target?e.target:e.srcElement;
    while(target&&target.id!='DynMessLink')target=target.parentNode;
    if(!target||target.id!='DynMessLink')return;
    if(target.pinned){Selected='';return false;}
    msgId=target.name;
  }
  CloseMsg(Selected)
  if(Selected==msgId) Selected='';
  else { OpenMsg(msgId, false); Selected=msgId;}
  if (e){if(e.preventDefault)e.preventDefault;else e.returnValue=false;}
  return false;
}


//]]>
</script>

</head><body>

<a href="#Main"><img alt="Click here to Skip to main content" 
class="access-link" src="ImageSaveInDataBase.aspx_files/t.gif"></a>

<div style="width: 100%; padding: 0px; margin: 0px;">
	<div style="width: 100%;">

<table class="MemberNavBar" width="100%" cellpadding="5" cellspacing="0">
<tbody><tr>
<td style="font-weight: bold;">6,954,189 members and growing! (23,684 
online)</td>
<td align="right">



<div id="ctl00_MemberMenu_LoggedOffOptions" class="MemberNavBarText" 
style="margin: 0pt; padding: 0pt;">
	<a name="SignUp"></a>
<form name="subForm" id="subForm" 
action="/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx"
 method="post" style="margin: 0pt; padding: 0pt;">

<!-- This hidden field is used for identifying form which has made post request.
     (This form posts to another page and we need to know which form did the post request) -->
<input id="FormName" name="FormName" value="MenuBarForm" type="hidden">

Email    <input class="small-text" name="Email" id="Email" style="width:
 100px;" type="text">
Password <input class="small-text" name="Password" id="Password" 
style="width: 60px;" type="password">
<input value="Sign in" class="button" type="submit">
<script type="text/javascript">
function Join(){document.location.href='/script/Membership/Modify.aspx';return false;}
document.write('<input type="button" class="button" onclick="return Join();" value="Join"');
document.write('<input type="hidden" name="fld_quicksign" value="true" />');
</script><input class="button" onclick="return Join();" value="Join" 
type="button"><input name="fld_quicksign" value="true" type="hidden">
<input checked="checked" name="RememberMeCheck" id="RememberMeCheck" 
value="1" type="checkbox">
<label for="RememberMeCheck">Remember me?</label>&nbsp;
<a id="ctl00_MemberMenu_SendPassword" 
href="http://www.codeproject.com/script/Membership/SendPassword.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx"><img
 alt="help" src="ImageSaveInDataBase.aspx_files/help.gif" width="16px" 
align="middle" border="0" height="16px">Lost your password?</a>
</form>

</div>

</td>
</tr>
</tbody></table></div>
	<table width="100%" border="0" cellpadding="0" cellspacing="0"><tbody><tr>
		<td class="header"><a href="http://www.codeproject.com/"><img 
id="ctl00_Logo" title="The Code Project" 
src="ImageSaveInDataBase.aspx_files/logo225x90.gif" alt="Home" 
style="border-width: 0px;"></a></td>
		<td class="header align-right" width="100%"><script type="text/javascript">document.write(unescape("%3ca%20href%3d%22http%3a%2f%2fwww.codeproject.com%2fRedir.aspx%3fadid%3d13980%26adcrid%3d12521%26obid%3d10861%26obtid%3d2%26way%3dban%22%20target%3d%22_blank%22%20rel%3d%22nofollow%22%3e%3cimg%20id%3d%22ctl00_TopAd%22%20src%3d%22%2fimages%2ft.gif%22%20width%3d%22728px%22%20height%3d%2290px%22%20alt%3d%22%22%20border%3d%220%22%2f%3e%3c%2fa%3e"));</script><a
 
href="http://www.codeproject.com/Redir.aspx?adid=13980&amp;adcrid=12521&amp;obid=10861&amp;obtid=2&amp;way=ban"
 target="_blank" rel="nofollow"><img id="ctl00_TopAd" 
src="ImageSaveInDataBase.aspx_files/ServeImg.aspx" alt="" width="728px" 
border="0" height="90px"></a>
		</td>
	</tr></tbody></table>
	

<div class="navbar clearfix">
<ul id="nav">

<li><a href="http://www.codeproject.com/">Home</a></li>


<li><a id="ctl00_TopNavBar_Art" class="down" 
href="http://www.codeproject.com/script/Articles/Latest.aspx">Articles</a>

	<ul>
		<li><a id="ctl00_TopNavBar_ArtSearch" class="fly break" 
href="http://www.codeproject.com/info/search.aspx">Search</a></li>
		<li><a id="ctl00_TopNavBar_ArtLatestArts" class="fly" 
href="http://www.codeproject.com/script/Articles/Latest.aspx">Latest 
Articles</a></li>
		<li><a id="ctl00_TopNavBar_ArtLatestTips" class="fly" 
href="http://www.codeproject.com/script/Articles/Latest.aspx?at=6">Latest
 Tips/Tricks</a></li>
		<li><a id="ctl00_TopNavBar_ArtTop" class="fly" 
href="http://www.codeproject.com/script/Articles/TopArticles.aspx?ta_so=4">Top
 Articles</a></li>
		<li><a id="ctl00_TopNavBar_ArtBeginner" class="fly" 
href="http://www.codeproject.com/info/search.aspx?aidlst=152&amp;sa_us=True">Beginner
 Articles</a></li>
		<li><a id="ctl00_TopNavBar_ArtBlogArticles" class="fly break" 
href="http://www.codeproject.com/script/Articles/BlogArticleList.aspx">Technical
 Blogs</a></li>
		<li><a id="ctl00_TopNavBar_ArtPostArticle" class="fly" 
href="http://www.codeproject.com/info/Submit.aspx">Post an Article</a></li>
		<li><a id="ctl00_TopNavBar_ArtPostTipTrick" class="fly" 
href="http://www.codeproject.com/script/Answers/Post.aspx?new=tipntrick">Post
 Tip &amp; Trick</a></li>
		<li><a id="ctl00_TopNavBar_ArtPostBlog" class="fly break" 
href="http://www.codeproject.com/script/Articles/BlogFeed.aspx">Post 
your Blog</a></li>
		<li><a id="ctl00_TopNavBar_ArtGuide" class="fly" 
href="http://www.codeproject.com/info/Submit.aspx">Posting/Update 
Guidelines</a></li>
		<li><a id="ctl00_TopNavBar_ArtCompetition" class="fly" 
href="http://www.codeproject.com/script/Awards/CurrentCompetitions.aspx?cmpTpId=1">Article
 Competition</a></li>
		<li><a id="ctl00_TopNavBar_ArtTopicList" class="fly last" 
href="http://www.codeproject.com/script/Content/SiteMap.aspx">Topic List</a></li>
	</ul>

</li>



<li><a id="ctl00_TopNavBar_Answers" 
href="http://www.codeproject.com/script/Answers/List.aspx?tab=latest">Quick
 Answers</a>
	<ul>
		<li><a id="ctl00_TopNavBar_QAAsk" class="fly" 
href="http://www.codeproject.com/script/Answers/Post.aspx?new=question">Ask
 a Question</a></li>
		<li><a id="ctl00_TopNavBar_QAUnanswered" class="fly" 
href="http://www.codeproject.com/script/Answers/List.aspx?tab=unanswered">View
 Unanswered Questions</a></li>
		<li><a id="ctl00_TopNavBar_QALatest" class="fly" 
href="http://www.codeproject.com/script/Answers/List.aspx?tab=latest">View
 All Questions</a></li>
		
	</ul>

</li>



<li><a id="ctl00_TopNavBar_MessageBoards" class="down" 
href="http://www.codeproject.com/script/Forums/List.aspx">Message Boards</a>

	<ul>
		<li><a class="fly" 
href="http://www.codeproject.com/Forums/12076/ASP-NET.aspx">ASP.NET</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/4486/ATL-WTL-STL.aspx">ATL /  
WTL / STL</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1647/C-Cplusplus-MFC.aspx">C / 
C++ / MFC</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/3785/Managed-Cplusplus-CLI.aspx">Managed
 C++/CLI</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1649/Csharp.aspx">C#</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1648/COM.aspx">COM</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/186301/Hardware-Devices.aspx">Hardware
 &amp; Devices</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1004117/LINQ.aspx">LINQ</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1650/NET-Framework.aspx">.NET 
Framework</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1644/System-Admin.aspx">System 
Admin</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1004257/Silverlight.aspx">Silverlight</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1725/General-Database.aspx">General
 Database</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1540733/Sharepoint.aspx">Sharepoint</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1646/Visual-Basic.aspx">Visual 
Basic</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1640/Web-Development.aspx">Web 
Development</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1004114/WPF-WCF-WF.aspx">WPF / 
WCF / WF</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/3421/XML-XSL.aspx">XML / XSL</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1642/General-IT-Issues.aspx">General
 IT Issues</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1645/Site-Bugs-Suggestions.aspx">Site
 Bugs / Suggestions</a></li>
<li><a class="fly" 
href="http://www.codeproject.com/Forums/1536756/The-Soapbox-2-0.aspx">The
 Soapbox 2.0</a></li>

		<li><a id="ctl00_TopNavBar_MessageBoardsAll" class="last" 
href="http://www.codeproject.com/script/Forums/List.aspx">All Message 
Boards...</a></li>
	</ul>

</li>



<li><a id="ctl00_TopNavBar_Job" 
href="http://www.codeproject.com/script/Jobs/List.aspx">Job Board</a>
	<ul>
		<li><a id="ctl00_TopNavBar_JobLatest" class="fly" 
href="http://www.codeproject.com/script/Jobs/List.aspx">Latest</a></li>
		<li><a id="ctl00_TopNavBar_JobSearch" class="fly" 
href="http://www.codeproject.com/script/Jobs/Search.aspx">Search</a></li>
		<li><a id="ctl00_TopNavBar_JobPost" class="fly" 
href="http://www.codeproject.com/script/Jobs/Edit.aspx">Post a Job</a></li>
		<li><a id="ctl00_TopNavBar_JobFaq" class="fly last" 
href="http://www.codeproject.com/KB/FAQs/JobBoardFAQ.aspx">FAQ and 
Pricing</a></li>
	</ul>

</li>




<li><a id="ctl00_TopNavBar_Cat" 
href="http://www.codeproject.com/script/Catalog/List.aspx">Catalog</a>
	<ul>
		<li><a id="ctl00_TopNavBar_CatLatest" class="fly" 
href="http://www.codeproject.com/script/Catalog/List.aspx?ctls=DatePostedDescending">Latest</a></li>
		<li><a id="ctl00_TopNavBar_CatSearch" class="fly" 
href="http://www.codeproject.com/script/Catalog/List.aspx">Search</a></li>
		<li><a id="ctl00_TopNavBar_CatPost" class="fly" 
href="http://www.codeproject.com/script/Catalog/Edit.aspx">Post a 
Catalog Item</a></li>
		<li><a id="ctl00_TopNavBar_CatFaq" class="fly last" 
href="http://www.codeproject.com/KB/FAQs/CatalogFAQ.aspx">FAQ and 
Pricing</a></li>
	</ul>

</li>






<li><a id="ctl00_TopNavBar_Help" 
href="http://www.codeproject.com/KB/FAQs/">Help!</a>

	<ul>
		<li><a id="ctl00_TopNavBar_HelpWhatIs" class="fly" 
href="http://www.codeproject.com/info/guide.aspx">What is 'The Code 
Project'?</a></li>
		<li><a id="ctl00_TopNavBar_HelpGeneral" class="fly" 
href="http://www.codeproject.com/KB/FAQs/">General FAQ</a></li>
		<li><a id="ctl00_TopNavBar_HelpPostQuestion" class="fly" 
href="http://www.codeproject.com/script/Forums/List.aspx">Post a 
Question</a></li>
		<li><a id="ctl00_TopNavBar_HelpSiteMap" class="fly" 
href="http://www.codeproject.com/script/Content/SiteMap.aspx">Site 
Directory</a></li>
		<li><a id="ctl00_TopNavBar_HelpAboutUs" class="fly last" 
href="http://www.codeproject.com/info/about.aspx">About Us</a></li>
	</ul>

</li>


<li style="float: right;">
<a style="display: inline;" id="ctl00_TopNavBar_Lounge" 
href="http://www.codeproject.com/Lounge.aspx">Lounge</a>
<a id="ctl00_TopNavBar_Soapbox" href="javascript:void();" 
style="display: none;">Soapbox</a>

</li>

</ul>

</div>
	<div style="width: 100%;"><a name="_top"></a>
		<table id="ctl00_ArticleTopHeader_HeaderTable" class="ArticleHeader 
extended" cellpadding="3">
	<tbody><tr valign="top">
		<td class="small-text">
	
	<a id="ctl00_ArticleTopHeader_ChapterLink" 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=4">Database</a>
 »
	<a id="ctl00_ArticleTopHeader_SectionLink" 
href="http://www.codeproject.com/KB/database/">Database</a> »
	<a id="ctl00_ArticleTopHeader_SubsectionLink" 
href="http://www.codeproject.com/KB/database/index.aspx?#Database%20-%20SQL%20Server">SQL
 Server</a>
	
	<span id="ctl00_ArticleTopHeader_SkillLevel" 
class="ArticleIntermediate">&nbsp;&nbsp;&nbsp; Intermediate</span> 
	<span id="ctl00_ArticleTopHeader_LicenceTerms"></span>
	<br>
	<br>
	<h1 id="ctl00_ArticleTopHeader_ArticleTitle">Storing and Retrieving 
Images from SQL Server using Microsoft .NET</h1>
	
		<b>By <a 
href="http://www.codeproject.com/script/Articles/MemberArticles.aspx?amid=1539279">Kazim
 Sardar Mehdi</a></b><br>
	
	<br>
    <span id="ctl00_ArticleTopHeader_ArticleDescr">Storing and 
retrieving images from SQL Server using Microsoft .NET.</span>
</td>
		<td style="width: 210px;">
	<span id="ctl00_ArticleTopHeader_ArticleAttributes" class="small-text">C#,
 SQL, Windows, .NET1.1, ADO.NET, SQL2000, VS.NET2003, DBA, Dev</span>
	<table style="margin: 8px 0pt 0pt; padding: 0pt;" class="small-text">
	
	<tbody><tr><td>Posted:</td><td><b>30 Jun 2005</b></td></tr>
	
	<tr><td>Views:</td><td><b>254,877</b></td></tr>
	
	<tr><td>Bookmarked:</td><td><b>99 times</b></td></tr>
	
	
	
	
	</tbody></table>
</td>
	</tr>
</tbody></table>

	</div>
</div>

<div>

<div id="ctl00_LHNavBar" class="nav-left">

	

<div class="blank-background">
<div class="announce-header">Announcements</div>
<div class="announce-content">
<table cellpadding="2">











<tbody><tr valign="middle"><td><img 
id="ctl00_Announcements_News_ctl00_Img" 
src="ImageSaveInDataBase.aspx_files/11875.png" alt="News" style="height:
 24px; width: 24px; border-width: 0px;" align="middle"></td>
<td><a id="ctl00_Announcements_News_ctl00_Link" 
href="http://www.codeproject.com/Feature/TechSummit/">Register for the 
free VS 2010 Tech Summit</a></td></tr>

<tr valign="middle"><td><img id="ctl00_Announcements_News_ctl01_Img" 
src="ImageSaveInDataBase.aspx_files/azure_24.png" alt="News" 
style="height: 24px; width: 24px; border-width: 0px;" align="middle"></td>
<td><a id="ctl00_Announcements_News_ctl01_Link" 
href="http://www.codeproject.com/feature/azure">Try Azure, Win a Laptop</a></td></tr>

<tr valign="middle"><td><img id="ctl00_Announcements_News_ctl02_Img" 
src="ImageSaveInDataBase.aspx_files/VSX_24.gif" alt="News" 
style="height: 24px; width: 24px; border-width: 0px;" align="middle"></td>
<td><a id="ctl00_Announcements_News_ctl02_Link" 
href="http://www.codeproject.com/Competitions/376/Visual-Studio-Extension.aspx">Build
 a VS2010 addin win a Zune</a></td></tr>

<tr valign="middle"><td><img id="ctl00_Announcements_News_ctl03_Img" 
src="ImageSaveInDataBase.aspx_files/MonthlyComp.png" alt="News" 
style="height: 24px; width: 24px; border-width: 0px;" align="middle"></td>
<td><a id="ctl00_Announcements_News_ctl03_Link" 
href="http://www.codeproject.com/script/Awards/CurrentCompetitions.aspx?cmpTpId=1">Monthly
 Competition</a></td></tr>




</tbody></table>
</div>
</div>
	

<div class="blank-background">
<div class="announce-header">The Daily Insider</div>
<div class="announce-content">
<table cellpadding="2">


<tbody><tr valign="middle"><td></td>
<td><a id="ctl00_News_News_ctl00_Link" 
href="http://gizmodo.com/5498412/sql-injection-license-plate-hopes-to-foil-euro-traffic-cameras">SQL
 Injection License Plate Hopes to Foil Euro Traffic Cameras</a></td></tr>


</tbody></table>

Daily IT news: <a id="ctl00_News_Subscribe" 
href="http://www.codeproject.com/Feature/Insider/">Signup now</a>.
</div>
</div>		
	
<div id="Th">
</div>

	
	
	<div id="SectionMenu">
<div class="menu1">Articles</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=1" 
onclick="return ToggleMenu('Chapter1');">Desktop Development</a></div>
<div class="menu2-dropdown" id="Chapter1" style="display: none;">
<div class="menu3" id="Section1"><a 
href="http://www.codeproject.com/KB/buttons/">Button Controls</a></div>
<div class="menu3" id="Section15"><a 
href="http://www.codeproject.com/KB/clipboard/">Clipboard</a></div>
<div class="menu3" id="Section2"><a 
href="http://www.codeproject.com/KB/combobox/">Combo &amp; List Boxes</a></div>
<div class="menu3" id="Section67"><a 
href="http://www.codeproject.com/KB/dialog/">Dialogs and Windows</a></div>
<div class="menu3" id="Section107"><a 
href="http://www.codeproject.com/KB/gadgets/">Desktop Gadgets</a></div>
<div class="menu3" id="Section16"><a 
href="http://www.codeproject.com/KB/docview/">Document / View</a></div>
<div class="menu3" id="Section4"><a 
href="http://www.codeproject.com/KB/edit/">Edit Controls</a></div>
<div class="menu3" id="Section17"><a 
href="http://www.codeproject.com/KB/files/">Files and Folders</a></div>
<div class="menu3" id="Section3"><a 
href="http://www.codeproject.com/KB/grid/">Grid &amp; Data Controls</a></div>
<div class="menu3" id="Section5"><a 
href="http://www.codeproject.com/KB/list/">List Controls</a></div>
<div class="menu3" id="Section6"><a 
href="http://www.codeproject.com/KB/menus/">Menus</a></div>
<div class="menu3" id="Section14"><a 
href="http://www.codeproject.com/KB/miscctrl/">Miscellaneous</a></div>
<div class="menu3" id="Section18"><a 
href="http://www.codeproject.com/KB/printing/">Printing</a></div>
<div class="menu3" id="Section95"><a 
href="http://www.codeproject.com/KB/progress/">Progress Controls</a></div>
<div class="menu3" id="Section11"><a 
href="http://www.codeproject.com/KB/selection/">Selection Controls</a></div>
<div class="menu3" id="Section19"><a 
href="http://www.codeproject.com/KB/shell/">Shell and IE programming</a></div>
<div class="menu3" id="Section68"><a 
href="http://www.codeproject.com/KB/smart/">Smart Client</a></div>
<div class="menu3" id="Section8"><a 
href="http://www.codeproject.com/KB/splitter/">Splitter Windows</a></div>
<div class="menu3" id="Section9"><a 
href="http://www.codeproject.com/KB/static/">Static &amp; Panel Controls</a></div>
<div class="menu3" id="Section10"><a 
href="http://www.codeproject.com/KB/statusbar/">Status Bar</a></div>
<div class="menu3" id="Section7"><a 
href="http://www.codeproject.com/KB/tabs/">Tabs &amp; Property Pages</a></div>
<div class="menu3" id="Section12"><a 
href="http://www.codeproject.com/KB/toolbars/">Toolbars &amp; Docking 
windows</a></div>
<div class="menu3" id="Section13"><a 
href="http://www.codeproject.com/KB/tree/">Tree Controls</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=2" 
onclick="return ToggleMenu('Chapter2');">Web Development</a></div>
<div class="menu2-dropdown" id="Chapter2" style="display: none;">
<div class="menu3" id="Section70"><a 
href="http://www.codeproject.com/KB/ajax/">Ajax and Atlas</a></div>
<div class="menu3" id="Section27"><a 
href="http://www.codeproject.com/KB/applications/">Applications &amp; 
Tools</a></div>
<div class="menu3" id="Section85"><a 
href="http://www.codeproject.com/KB/asp/">ASP</a></div>
<div class="menu3" id="Section89"><a 
href="http://www.codeproject.com/KB/aspnet/">ASP.NET</a></div>
<div class="menu3" id="Section28"><a 
href="http://www.codeproject.com/KB/webforms/">ASP.NET Controls</a></div>
<div class="menu3" id="Section38"><a 
href="http://www.codeproject.com/KB/ATL-Server/">ATL Server</a></div>
<div class="menu3" id="Section29"><a 
href="http://www.codeproject.com/KB/web-cache/">Caching</a></div>
<div class="menu3" id="Section91"><a 
href="http://www.codeproject.com/KB/web-image/">Charts, Graphs and 
Images</a></div>
<div class="menu3" id="Section25"><a 
href="http://www.codeproject.com/KB/scripting/">Client side scripting</a></div>
<div class="menu3" id="Section30"><a 
href="http://www.codeproject.com/KB/custom-controls/">Custom Controls</a></div>
<div class="menu3" id="Section23"><a 
href="http://www.codeproject.com/KB/HTML/">HTML / CSS</a></div>
<div class="menu3" id="Section24"><a 
href="http://www.codeproject.com/KB/ISAPI/">ISAPI</a></div>
<div class="menu3" id="Section33"><a 
href="http://www.codeproject.com/KB/server-management/">Site &amp; 
Server Management</a></div>
<div class="menu3" id="Section34"><a 
href="http://www.codeproject.com/KB/session/">Session State</a></div>
<div class="menu3" id="Section113"><a 
href="http://www.codeproject.com/KB/silverlight/">Silverlight</a></div>
<div class="menu3" id="Section36"><a 
href="http://www.codeproject.com/KB/trace/">Trace and Logs</a></div>
<div class="menu3" id="Section31"><a 
href="http://www.codeproject.com/KB/user-controls/">User Controls</a></div>
<div class="menu3" id="Section37"><a 
href="http://www.codeproject.com/KB/validation/">Validation</a></div>
<div class="menu3" id="Section35"><a 
href="http://www.codeproject.com/KB/viewstate/">View State</a></div>
<div class="menu3" id="Section26"><a 
href="http://www.codeproject.com/KB/WAP/">WAP / WML</a></div>
<div class="menu3" id="Section32"><a 
href="http://www.codeproject.com/KB/web-security/">Web Security</a></div>
<div class="menu3" id="Section20"><a 
href="http://www.codeproject.com/KB/webservices/">Web Services</a></div>
<div class="menu3" id="Section144"><a 
href="http://www.codeproject.com/KB/PHP/">PHP</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=9" 
onclick="return ToggleMenu('Chapter9');">Enterprise Systems</a></div>
<div class="menu2-dropdown" id="Chapter9" style="display: none;">
<div class="menu3" id="Section98"><a 
href="http://www.codeproject.com/KB/MCMS/">Content Management Server</a></div>
<div class="menu3" id="Section99"><a 
href="http://www.codeproject.com/KB/biztalk/">Microsoft BizTalk Server</a></div>
<div class="menu3" id="Section102"><a 
href="http://www.codeproject.com/KB/exchange/">Microsoft Exchange</a></div>
<div class="menu3" id="Section90"><a 
href="http://www.codeproject.com/KB/office/">Office Development</a></div>
<div class="menu3" id="Section101"><a 
href="http://www.codeproject.com/KB/sharepoint/">SharePoint Server</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=3" 
onclick="return ToggleMenu('Chapter3');">Multimedia</a></div>
<div class="menu2-dropdown" id="Chapter3" style="display: none;">
<div class="menu3" id="Section42"><a 
href="http://www.codeproject.com/KB/audio-video/">Audio and Video</a></div>
<div class="menu3" id="Section44"><a 
href="http://www.codeproject.com/KB/directx/">DirectX</a></div>
<div class="menu3" id="Section46"><a 
href="http://www.codeproject.com/KB/GDI/">GDI</a></div>
<div class="menu3" id="Section47"><a 
href="http://www.codeproject.com/KB/GDI-plus/">GDI+</a></div>
<div class="menu3" id="Section43"><a 
href="http://www.codeproject.com/KB/graphics/">General Graphics</a></div>
<div class="menu3" id="Section45"><a 
href="http://www.codeproject.com/KB/openGL/">OpenGL</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=4" 
onclick="return ToggleMenu('Chapter4');">Database</a></div>
<div class="menu2-dropdown" id="Chapter4">
<div class="menu3 selected" id="Section66"><a 
href="http://www.codeproject.com/KB/database/">Database</a></div>
<div class="menu3" id="Section100"><a 
href="http://www.codeproject.com/KB/reporting-services/">SQL Reporting 
Services</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=8" 
onclick="return ToggleMenu('Chapter8');">Platforms, Frameworks &amp; 
Libraries</a></div>
<div class="menu2-dropdown" id="Chapter8" style="display: none;">
<div class="menu3" id="Section83"><a 
href="http://www.codeproject.com/KB/atl/">ATL</a></div>
<div class="menu3" id="Section117"><a 
href="http://www.codeproject.com/KB/MFC/">MFC</a></div>
<div class="menu3" id="Section88"><a 
href="http://www.codeproject.com/KB/stl/">STL</a></div>
<div class="menu3" id="Section84"><a 
href="http://www.codeproject.com/KB/wtl/">WTL</a></div>
<div class="menu3" id="Section49"><a 
href="http://www.codeproject.com/KB/COM/">COM / COM+</a></div>
<div class="menu3" id="Section76"><a 
href="http://www.codeproject.com/KB/dotnet/">.NET Framework</a></div>
<div class="menu3" id="Section92"><a 
href="http://www.codeproject.com/KB/winsdk/">Win32/64 SDK &amp; OS</a></div>
<div class="menu3" id="Section108"><a 
href="http://www.codeproject.com/KB/vista/">Vista API</a></div>
<div class="menu3" id="Section110"><a 
href="http://www.codeproject.com/KB/vista-security/">Vista Security</a></div>
<div class="menu3" id="Section82"><a 
href="http://www.codeproject.com/KB/cross-platform/">Cross Platform</a></div>
<div class="menu3" id="Section69"><a 
href="http://www.codeproject.com/KB/game/">Game Development</a></div>
<div class="menu3" id="Section73"><a 
href="http://www.codeproject.com/KB/mobile/">Mobile Development</a></div>
<div class="menu3" id="Section106"><a 
href="http://www.codeproject.com/KB/WC/">Windows CardSpace</a></div>
<div class="menu3" id="Section103"><a 
href="http://www.codeproject.com/KB/WCF/">Windows Communication 
Foundation</a></div>
<div class="menu3" id="Section104"><a 
href="http://www.codeproject.com/KB/WPF/">Windows Presentation 
Foundation</a></div>
<div class="menu3" id="Section105"><a 
href="http://www.codeproject.com/KB/WF/">Windows Workflow Foundation</a></div>
<div class="menu3" id="Section119"><a 
href="http://www.codeproject.com/KB/library/">Libraries</a></div>
<div class="menu3" id="Section122"><a 
href="http://www.codeproject.com/KB/powershell/">Windows Powershell</a></div>
<div class="menu3" id="Section123"><a 
href="http://www.codeproject.com/KB/linq/">LINQ</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=5" 
onclick="return ToggleMenu('Chapter5');">Languages</a></div>
<div class="menu2-dropdown" id="Chapter5" style="display: none;">
<div class="menu3" id="Section71"><a 
href="http://www.codeproject.com/KB/cpp/">C / C++ Language</a></div>
<div class="menu3" id="Section72"><a 
href="http://www.codeproject.com/KB/mcpp/">C++ / CLI</a></div>
<div class="menu3" id="Section93"><a 
href="http://www.codeproject.com/KB/cs/">C#</a></div>
<div class="menu3" id="Section78"><a 
href="http://www.codeproject.com/KB/msil/">MSIL</a></div>
<div class="menu3" id="Section86"><a 
href="http://www.codeproject.com/KB/vbscript/">VBScript</a></div>
<div class="menu3" id="Section87"><a 
href="http://www.codeproject.com/KB/vb/">VB.NET</a></div>
<div class="menu3" id="Section115"><a 
href="http://www.codeproject.com/KB/vb-interop/">VB6 Interop</a></div>
<div class="menu3" id="Section77"><a 
href="http://www.codeproject.com/KB/net-languages/">Other .NET Languages</a></div>
<div class="menu3" id="Section21"><a 
href="http://www.codeproject.com/KB/XML/">XML</a></div>
<div class="menu3" id="Section96"><a 
href="http://www.codeproject.com/KB/java/">Java</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=6" 
onclick="return ToggleMenu('Chapter6');">General Programming</a></div>
<div class="menu2-dropdown" id="Chapter6" style="display: none;">
<div class="menu3" id="Section57"><a 
href="http://www.codeproject.com/KB/recipes/">Algorithms &amp; Recipes</a></div>
<div class="menu3" id="Section64"><a 
href="http://www.codeproject.com/KB/bugs/">Bugs &amp; Workarounds</a></div>
<div class="menu3" id="Section79"><a 
href="http://www.codeproject.com/KB/collections/">Collections</a></div>
<div class="menu3" id="Section56"><a 
href="http://www.codeproject.com/KB/security/">Cryptography &amp; 
Security</a></div>
<div class="menu3" id="Section50"><a 
href="http://www.codeproject.com/KB/datetime/">Date and Time</a></div>
<div class="menu3" id="Section52"><a 
href="http://www.codeproject.com/KB/DLL/">DLLs &amp; Assemblies</a></div>
<div class="menu3" id="Section80"><a 
href="http://www.codeproject.com/KB/exception/">Exception Handling</a></div>
<div class="menu3" id="Section81"><a 
href="http://www.codeproject.com/KB/locale/">Localisation</a></div>
<div class="menu3" id="Section53"><a 
href="http://www.codeproject.com/KB/macros/">Macros and Add-ins</a></div>
<div class="menu3" id="Section54"><a 
href="http://www.codeproject.com/KB/tips/">Programming Tips</a></div>
<div class="menu3" id="Section55"><a 
href="http://www.codeproject.com/KB/string/">String handling</a></div>
<div class="menu3" id="Section22"><a 
href="http://www.codeproject.com/KB/IP/">Internet / Network</a></div>
<div class="menu3" id="Section58"><a 
href="http://www.codeproject.com/KB/threads/">Threads, Processes &amp; 
IPC</a></div>
<div class="menu3" id="Section59"><a 
href="http://www.codeproject.com/KB/winhelp/">WinHelp / HTMLHelp</a></div>
<div class="menu3" id="Section141"><a 
href="http://www.codeproject.com/KB/answers/">Uncategorised Quick 
Answers</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=10" 
onclick="return ToggleMenu('Chapter10');">Graphics / Design</a></div>
<div class="menu2-dropdown" id="Chapter10" style="display: none;">
<div class="menu3" id="Section40"><a 
href="http://www.codeproject.com/KB/expression/">Expression</a></div>
<div class="menu3" id="Section114"><a 
href="http://www.codeproject.com/KB/usability/">Usability</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=11" 
onclick="return ToggleMenu('Chapter11');">Development Lifecycle</a></div>
<div class="menu2-dropdown" id="Chapter11" style="display: none;">
<div class="menu3" id="Section51"><a 
href="http://www.codeproject.com/KB/debug/">Debug Tips</a></div>
<div class="menu3" id="Section39"><a 
href="http://www.codeproject.com/KB/architecture/">Design and 
Architecture</a></div>
<div class="menu3" id="Section112"><a 
href="http://www.codeproject.com/KB/install/">Installation</a></div>
<div class="menu3" id="Section41"><a 
href="http://www.codeproject.com/KB/work/">Work Issues</a></div>
<div class="menu3" id="Section128"><a 
href="http://www.codeproject.com/KB/testing/">Testing and QA</a></div>
<div class="menu3" id="Section126"><a 
href="http://www.codeproject.com/KB/codegen/">Code Generation</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=7" 
onclick="return ToggleMenu('Chapter7');">General Reading</a></div>
<div class="menu2-dropdown" id="Chapter7" style="display: none;">
<div class="menu3" id="Section60"><a 
href="http://www.codeproject.com/KB/books/">Book Chapters</a></div>
<div class="menu3" id="Section61"><a 
href="http://www.codeproject.com/KB/book-reviews/">Book Reviews</a></div>
<div class="menu3" id="Section109"><a 
href="http://www.codeproject.com/KB/hardware-review/">Hardware Reviews</a></div>
<div class="menu3" id="Section63"><a 
href="http://www.codeproject.com/KB/interviews/">Interviews</a></div>
<div class="menu3" id="Section62"><a 
href="http://www.codeproject.com/KB/scrapbook/">Scrapbook</a></div>
<div class="menu3" id="Section48"><a 
href="http://www.codeproject.com/KB/system/">Hardware &amp; System</a></div>
<div class="menu3" id="Section136"><a 
href="http://www.codeproject.com/KB/Blogs/">Uncategorised Technical 
Blogs</a></div>
<div class="menu3" id="Section145"><a 
href="http://www.codeproject.com/KB/FAQs/">CodeProject FAQs</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=12" 
onclick="return ToggleMenu('Chapter12');">Third Party Products</a></div>
<div class="menu2-dropdown" id="Chapter12" style="display: none;">
<div class="menu3" id="Section65"><a 
href="http://www.codeproject.com/KB/showcase/">Product Showcase</a></div>
<div class="menu3" id="Section124"><a 
href="http://www.codeproject.com/KB/solution-center/">Solution Center</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=13" 
onclick="return ToggleMenu('Chapter13');">Mentor Resources</a></div>
<div class="menu2-dropdown" id="Chapter13" style="display: none;">
<div class="menu3" id="Section140"><a 
href="http://www.codeproject.com/KB/mentor/">Author Resources</a></div>
</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Content/Chapter.aspx?chptId=14" 
onclick="return ToggleMenu('Chapter14');">Mobile Development</a></div>
<div class="menu2-dropdown" id="Chapter14" style="display: none;">
<div class="menu3" id="Section146"><a 
href="http://www.codeproject.com/KB/iPhone/">iPhone</a></div>
<div class="menu3" id="Section147"><a 
href="http://www.codeproject.com/KB/android/">Android</a></div>
<div class="menu3" id="Section148"><a 
href="http://www.codeproject.com/KB/windows/">Windows</a></div>
<div class="menu3" id="Section149"><a 
href="http://www.codeproject.com/KB/palm/">Palm</a></div>
<div class="menu3" id="Section150"><a 
href="http://www.codeproject.com/KB/miscellaneous/">Miscellaneous</a></div>
</div>
</div>
<div style="margin-top: 5px;"></div>
<div class="menu1">Services</div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Catalog/List.aspx">Product 
Catalog</a></div>
<div class="menu2"><a 
href="http://www.codeproject.com/script/Jobs/List.aspx">Job Board</a></div>
<div class="menu2"><a href="http://www.codeproject.com/Services/Addins/">CodeProject
 VS2008 Addin</a></div>
<div style="margin-top: 5px;"></div>
<div class="menu1">Feature Zones</div>
<div class="menu2"><a href="http://www.codeproject.com/kb/Showcase/">Product
 Showcase</a></div>
<div class="menu2"><a 
href="http://www.codeproject.com/Zones/WhitePapers/">WhitePapers / 
Webcasts</a></div>
<div class="menu2"><a 
href="http://www.codeproject.com/Redir.aspx?adid=13191&amp;obid=0&amp;obtid=0">.NET
 Dev Library</a></div>
<div class="menu2"><a 
href="http://www.codeproject.com/Redir.aspx?adid=12879&amp;obid=0&amp;obtid=0">ASP.NET
 Web Hosting</a></div>
<div style="margin-top: 5px;"></div>


	<div style="margin: auto; width: 150px;"><script type="text/javascript">document.write(unescape("%3ca%20href%3d%22http%3a%2f%2fwww.codeproject.com%2fRedir.aspx%3fadid%3d10335%26adcrid%3d10188%26obid%3d10861%26obtid%3d2%26way%3dban%22%20target%3d%22_blank%22%20rel%3d%22nofollow%22%3e%3cimg%20id%3d%22ctl00_LeftHandAd%22%20src%3d%22%2fimages%2ft.gif%22%20width%3d%22150px%22%20height%3d%2280px%22%20alt%3d%22%22%20border%3d%220%22%2f%3e%3c%2fa%3e"));</script><a
 
href="http://www.codeproject.com/Redir.aspx?adid=10335&amp;adcrid=10188&amp;obid=10861&amp;obtid=2&amp;way=ban"
 target="_blank" rel="nofollow"><img id="ctl00_LeftHandAd" 
src="ImageSaveInDataBase.aspx_files/ServeImg_002.gif" alt="" 
width="150px" border="0" height="80px"></a>
	</div>
	
	<div style="margin: 10px auto auto; width: 160px;"><div 
id="ctl00_TowerAd" style="display: inline-block; width: 160px; height: 
600px;" title=""><iframe 
src="ImageSaveInDataBase.aspx_files/ServeHtml.htm" width="160px" 
frameborder="0" height="600px" scrolling="no"></iframe></div>
	</div>
</div>

<div id="ctl00_ArticlePane" class="container-article borders-left-nav">

	
<table class="nav-search extended" cellspacing="0">
<tbody><tr>
<td width="100%">&nbsp;</td>
<td style="white-space: nowrap; width: 60%;" valign="middle" 
align="right">
	<form method="get" action="/info/search.aspx" name="Search" 
style="margin: 0pt;">
	<b>Search &nbsp;</b>
	<input class="small-text" name="artkw" style="width: 200px;">
	<select class="small-text offblack" style="font-weight: bold;" 
name="sbo">
	<option value="kw" selected="selected">Articles / Quick Answers</option>
<option value="fm">Messages</option>
<option value="s">Jobs</option>
<option value="ctlk">Product Catalog</option>

	</select>
	<input class="button small-text" value=" Go! " type="submit"> &nbsp;
	</form>
</td>
<td class="tiny-text" style="white-space: nowrap;">
	
	<a href="http://www.codeproject.com/info/search.aspx">Advanced Search</a><br>
	
	
	<a id="ctl00_SearchBarCtrl_AddToIESearchLnk" 
href="http://www.codeproject.com/">Add to IE Search</a>
</td>
</tr>
</tbody></table>

	<a name="Main"></a>
	<span id="ctl00_ResultMessage"></span>
	
	
    
	<div id="ctl00_ArtDiv">
	<table border="0" cellpadding="0" cellspacing="0">	
	<tbody><tr valign="top">
		<td valign="top" width="100%">
		    
<table>

</table>



			
<div class="small-text">
<img src="ImageSaveInDataBase.aspx_files/print.gif" alt="print" 
style="vertical-align: middle;" width="16px" height="16px"><a 
id="ctl00_ArticleHeaderLinks_PrintLnk" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?display=Print">Print
 Friendly</a> &nbsp;
	


<span id="SBI"><img src="ImageSaveInDataBase.aspx_files/add.gif" 
id="ctl00_ArticleHeaderLinks_AddTo_Img" alt="add" style="vertical-align:
 middle;" width="16" height="16">
<a href="#">Share</a></span>
<div style="left: 246.5px; top: 319.9px;" id="ATD"><div><a class="AddTo"
 title="Add this page to Digg" onclick="return socialLinks.addto(0);" 
href="#"><img src="ImageSaveInDataBase.aspx_files/AddTo_Digg.png" 
width="16px" align="absmiddle" border="0" height="16px"> Digg</a> </div><div><a
 class="AddTo" title="Add this page to Del.icio.us" onclick="return 
socialLinks.addto(1);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/AddTo_Delicious.png" width="16px" 
align="absmiddle" border="0" height="16px"> Del.icio.us</a> </div><div><a
 class="AddTo" title="Add this page to Google" onclick="return 
socialLinks.addto(2);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/AddTo_Google.png" width="16px" 
align="absmiddle" border="0" height="16px"> Google</a> </div><div><a 
class="AddTo" title="Add this page to Windows Live" onclick="return 
socialLinks.addto(3);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/AddTo_Live.png" width="16px" 
align="absmiddle" border="0" height="16px"> Windows Live</a> </div><div><a
 class="AddTo" title="Add this page to Technorati" onclick="return 
socialLinks.addto(4);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/AddTo_Technorati.png" width="16px" 
align="absmiddle" border="0" height="16px"> Technorati</a> </div><div><a
 class="AddTo" title="Add this page to Blink" onclick="return 
socialLinks.addto(5);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/AddTo_Blink.png" width="16px" 
align="absmiddle" border="0" height="16px"> Blink</a> </div><div><a 
class="AddTo" title="Add this page to Facebook" onclick="return 
socialLinks.addto(6);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/AddTo_Facebook.png" width="16px" 
align="absmiddle" border="0" height="16px"> Facebook</a> </div><div><a 
class="AddTo" title="Add this page to Furl" onclick="return 
socialLinks.addto(7);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/AddTo_Furl.png" width="16px" 
align="absmiddle" border="0" height="16px"> Furl</a> </div><div><a 
class="AddTo" title="Add this page to Simpy" onclick="return 
socialLinks.addto(8);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/AddTo_Simpy.png" width="16px" 
align="absmiddle" border="0" height="16px"> Simpy</a> </div><div><a 
class="AddTo" title="Add this page to Reddit" onclick="return 
socialLinks.addto(9);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/AddTo_Reddit.png" width="16px" 
align="absmiddle" border="0" height="16px"> Reddit</a> </div><div><a 
class="AddTo" title="Add this page to Newsvine" onclick="return 
socialLinks.addto(10);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/AddTo_Newsvine.png" width="16px" 
align="absmiddle" border="0" height="16px"> Newsvine</a> </div><div><a 
class="AddTo" title="Add this page to Stumbleupon" onclick="return 
socialLinks.addto(11);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/AddTo_stumbleupon.png" width="16px" 
align="absmiddle" border="0" height="16px"> Stumbleupon</a> </div><div><a
 class="AddTo" title="Add this page to Mr. Wong" onclick="return 
socialLinks.addto(12);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/AddTo_MrWong.png" width="16px" 
align="absmiddle" border="0" height="16px"> Mr. Wong</a> </div><div><a 
class="AddTo" title="Send as Email" onclick="return 
socialLinks.addto(13);" href="#"><img 
src="ImageSaveInDataBase.aspx_files/envelope.gif" width="16px" 
align="absmiddle" border="0" height="16px"> Send as Email</a> </div></div>
 &nbsp;
 &nbsp;
 &nbsp;
<img src="ImageSaveInDataBase.aspx_files/discuss.gif" alt="Discuss" 
style="vertical-align: middle;" width="15px" height="16px"> <a 
href="#_comments">Discuss</a> &nbsp; 

<img src="ImageSaveInDataBase.aspx_files/report.gif" alt="Broken 
Article?" style="vertical-align: middle;" width="16px" height="16px"><a 
id="ctl00_ArticleHeaderLinks_BrokenLnk" 
href="http://www.codeproject.com/script/Articles/Report.aspx?aid=10861">Report</a>
 &nbsp;
</div>
		</td>
		<td style="text-align: right; white-space: nowrap; width: 100px;">
		<table id="ctl00_CurRat" name="CurRat_10861">
	<tbody><tr>
		<td>
<table class="">
<tbody><tr>
	<td id="ctl00_ArticleRating_VL" style="white-space: nowrap;" 
class="small-text" align="right"> 
		<span id="ctl00_ArticleRating_VoteLabel">44 votes for this article.</span>
	</td>
		
	<td>
		<table border="1" cellpadding="0" cellspacing="0">
			<tbody><tr>
				<td width="20px" align="left" bgcolor="White" height="7px"><img 
src="ImageSaveInDataBase.aspx_files/red.gif" width="20" align="middle" 
border="0" height="7"></td>
				<td width="20px" align="left" bgcolor="White" height="7px"><img 
src="ImageSaveInDataBase.aspx_files/red.gif" width="20" align="middle" 
border="0" height="7"></td>
				<td width="20px" align="left" bgcolor="White" height="7px"><img 
src="ImageSaveInDataBase.aspx_files/red.gif" width="20" align="middle" 
border="0" height="7"></td>
				<td style="white-space: nowrap; padding: 0px;" width="20px" 
align="left" bgcolor="White" height="7px"><img 
src="ImageSaveInDataBase.aspx_files/red.gif" width="14" align="middle" 
border="0" height="7"><img 
src="ImageSaveInDataBase.aspx_files/white.gif" width="6" align="middle" 
border="0" height="7"></td>
				<td width="20px" align="left" bgcolor="White" height="7px"><img 
src="ImageSaveInDataBase.aspx_files/white.gif" width="20" align="middle"
 border="0" height="7"></td>
			</tr>
		</tbody></table>
		
		<span id="ctl00_ArticleRating_Votes" class="small-text"></span>
	</td>
</tr>
<tr id="ctl00_ArticleRating_PopularityRow">
			<td colspan="2" class="small-text" align="right">
		<a id="ctl00_ArticleRating_PopularityLnk" title="Calculated as rating x
 Log10(# votes)" 
href="http://www.codeproject.com/script/Articles/TopArticles.aspx?ta_so=1">Popularity:
 6.11</a>
		<span id="ctl00_ArticleRating_PopularityLbl"></span>
		<span id="ratingVal">Rating: <b>3.72</b> out of 5</span>
		
	</td>
		</tr>
		
</tbody></table>
</td>
		<td>            
<div>
<table class="HistTable" title="Voting Distribution. Recent data only"><tbody><tr><td><img
 src="ImageSaveInDataBase.aspx_files/pollcol.gif" alt="5 votes, 11.4%" 
title="5 votes, 11.4%" width="10px" border="0px" height="4px"><br>1</td>
<td><img src="ImageSaveInDataBase.aspx_files/pollcol.gif" alt="1 vote, 
2.3%" title="1 vote, 2.3%" width="10px" border="0px" height="1px"><br>2</td>
<td><img src="ImageSaveInDataBase.aspx_files/pollcol.gif" alt="1 vote, 
2.3%" title="1 vote, 2.3%" width="10px" border="0px" height="1px"><br>3</td>
<td><img src="ImageSaveInDataBase.aspx_files/pollcol.gif" alt="14 votes,
 31.8%" title="14 votes, 31.8%" width="10px" border="0px" height="12px"><br>4</td>
<td><img src="ImageSaveInDataBase.aspx_files/pollcol.gif" alt="23 votes,
 52.3%" title="23 votes, 52.3%" width="10px" border="0px" height="20px"><br>5</td>
</tr></tbody></table>
</div>



</td>
	</tr>
</tbody></table>

		</td>
	</tr>
	</tbody></table>
	
	
	
	

	
	

	
	
	
	
	
	
	
	
	
	
	
	
	<div id="contentdiv">
	
	<!-- Main Page Contents Start -->
	

<!-- Article Starts -->

<ul class="download">
<li><a 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase/ImageSaveInDataBase.zip">Download
 source - 19.6 Kb</a> </li></ul>
<h2>Introduction</h2>
<p>This article is about storing and retrieving images from database in 
Microsoft .NET using C#.</p>
<h2>Tools Used</h2>
<ul>
<li>SQL Server 2000 
</li><li>Microsoft .NET Version 1.1 
</li><li>C# (Windows Forms based application) </li></ul>
<h2>Storing Images</h2>
<ol>
<li>Create a table in a SQL Server 2000 database which has at least one 
field of type <code>IMAGE</code>. 
<p>Here is the script I used:</p><div class="small-text" id="premain0" 
style="width: 100%; cursor: pointer;"><img preid="0" 
src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg0" width="9" 
height="9"><span preid="0" style="margin-bottom: 0pt;" id="precollapse0">
 Collapse</span></div><pre style="margin-top: 0pt;" id="pre0" lang="sql"><span class="code-keyword">CREATE</span> <span class="code-keyword">TABLE</span> [dbo].[tblImgData] (

        [ID] [<span class="code-keyword">int</span>] <span class="code-keyword">NOT</span> <span class="code-keyword">NULL</span> ,

        [Name] [<span class="code-keyword">varchar</span>] (<span class="code-digit">50</span>) <span class="code-keyword">COLLATE</span> SQL_Latin1_General_CP1_CI_AS <span class="code-keyword">NULL</span> ,

        [Picture] [<span class="code-keyword">image</span>] <span class="code-keyword">NULL</span> 

) <span class="code-keyword">ON</span> [<span class="code-keyword">PRIMARY</span>] TEXTIMAGE_ON [<span class="code-keyword">PRIMARY</span>]</pre>
</li><li>Actually <code>IMAGE</code> field is just holding the reference
 to the page containing the binary data so we have to convert our image 
into bytes. 
<ol type="a">
<li>I used a file open dialog box to locate the file. <div 
class="small-text" id="premain1" style="width: 100%; cursor: pointer;"><img
 preid="1" src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg1" 
width="9" height="9"><span preid="1" style="margin-bottom: 0pt;" 
id="precollapse1"> Collapse</span></div><pre style="margin-top: 0pt;" id="pre1" lang="cs"><span class="code-keyword">this</span>.openFileDialog1.ShowDialog(<span class="code-keyword">this</span>);
<span class="code-keyword">string</span> strFn=this.openFileDialog1.FileName;</pre>
</li><li>By using <code>FileInfo</code> class, I retrieved the file 
size: <div class="small-text" id="premain2" style="width: 100%; cursor: 
pointer;"><img preid="2" src="ImageSaveInDataBase.aspx_files/minus.gif" 
id="preimg2" width="9" height="9"><span preid="2" style="margin-bottom: 
0pt;" id="precollapse2"> Collapse</span></div><pre style="margin-top: 0pt;" id="pre2" lang="cs">FileInfo fiImage=new FileInfo(strFn);</pre>
</li><li>Declare an array of that size. <div class="small-text" 
id="premain3" style="width: 100%; cursor: pointer;"><img preid="3" 
src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg3" width="9" 
height="9"><span preid="3" style="margin-bottom: 0pt;" id="precollapse3">
 Collapse</span></div><pre style="margin-top: 0pt;" id="pre3" lang="cs"><span class="code-keyword">this</span>.m_lImageFileLength=fiImage.Length;
m_barrImg=new <span class="code-keyword">byte</span>[Convert.ToInt32(<span class="code-keyword">this</span>.m_lImageFileLength)];</pre>
</li><li>By using <code>FileStream</code> object, I filled the byte 
array. <div class="small-text" id="premain4" style="width: 100%; cursor:
 pointer;"><img preid="4" src="ImageSaveInDataBase.aspx_files/minus.gif"
 id="preimg4" width="9" height="9"><span preid="4" style="margin-bottom:
 0pt;" id="precollapse4"> Collapse</span></div><pre style="margin-top: 0pt;" id="pre4" lang="cs">FileStream fs=new FileStream(strFn,FileMode.Open, 
                  FileAccess.Read,FileShare.Read);
<span class="code-keyword">int</span> iBytesRead=fs.Read(m_barrImg,<span class="code-digit">0</span>,
               Convert.ToInt32(<span class="code-keyword">this</span>.m_lImageFileLength));
fs.Close();</pre></li></ol>
<h3>Complete Load Image Code</h3><div class="small-text" id="premain5" 
style="width: 100%; cursor: pointer;"><img preid="5" 
src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg5" width="9" 
height="9"><span preid="5" style="margin-bottom: 0pt;" id="precollapse5">
 Collapse</span></div><pre style="margin-top: 0pt;" id="pre5" lang="cs"><span class="code-keyword">protected</span> <span class="code-keyword">void</span> LoadImage()
{
    <span class="code-keyword">try</span>
    {
        <span class="code-keyword">this</span>.openFileDialog1.ShowDialog(<span class="code-keyword">this</span>);
        <span class="code-keyword">string</span> strFn=this.openFileDialog1.FileName;
        <span class="code-keyword">this</span>.pictureBox1.Image=Image.FromFile(strFn);
        FileInfo fiImage=new FileInfo(strFn);
        <span class="code-keyword">this</span>.m_lImageFileLength=fiImage.Length;
        FileStream fs=new FileStream(strFn,FileMode.Open, 
                          FileAccess.Read,FileShare.Read);
        m_barrImg=new <span class="code-keyword">byte</span>[Convert.ToInt32(<span class="code-keyword">this</span>.m_lImageFileLength)];
        <span class="code-keyword">int</span> iBytesRead = fs.Read(m_barrImg,<span class="code-digit">0</span>, 
                         Convert.ToInt32(<span class="code-keyword">this</span>.m_lImageFileLength));
        fs.Close();
    }
    <span class="code-keyword">catch</span>(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}</pre>
</li><li>Saving byte array data to database. 
<ol type="a">
<li>Create command text to insert record. <div class="small-text" 
id="premain6" style="width: 100%; cursor: pointer;"><img preid="6" 
src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg6" width="9" 
height="9"><span preid="6" style="margin-bottom: 0pt;" id="precollapse6">
 Collapse</span></div><pre style="margin-top: 0pt;" id="pre6" lang="cs"><span class="code-keyword">this</span>.sqlCommand1.CommandText= 
  <span class="code-string">"</span><span class="code-string">INSERT INTO tblImgData(ID,Name,Picture)"</span> + 
  <span class="code-string">"</span><span class="code-string"> values(@ID,@Name,@Picture)"</span>;</pre>
</li><li>Create parameters. <div class="small-text" id="premain7" 
style="width: 100%; cursor: pointer;"><img preid="7" 
src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg7" width="9" 
height="9"><span preid="7" style="margin-bottom: 0pt;" id="precollapse7">
 Collapse</span></div><pre style="margin-top: 0pt;" id="pre7" lang="cs"><span class="code-keyword">this</span>.sqlCommand1.Parameters.Add(<span class="code-string">"</span><span class="code-string">@ID"</span>,
           System.Data.SqlDbType.Int, <span class="code-digit">4</span>);
<span class="code-keyword">this</span>.sqlCommand1.Parameters.Add(<span class="code-string">"</span><span class="code-string">@Name"</span>, 
           System.Data.SqlDbType.VarChar, <span class="code-digit">50</span>);

<span class="code-keyword">this</span>.sqlCommand1.Parameters.Add(<span class="code-string">"</span><span class="code-string">@Picture"</span>, 
           System.Data.SqlDbType.Image);</pre>
<p>Notice �<code>@Picture</code>� has �<code>SqlDbType.Image</code>� 
because it is of <code>IMAGE</code> type Field.</p>
</li><li>Provide the value to the parameters. <div class="small-text" 
id="premain8" style="width: 100%; cursor: pointer;"><img preid="8" 
src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg8" width="9" 
height="9"><span preid="8" style="margin-bottom: 0pt;" id="precollapse8">
 Collapse</span></div><pre style="margin-top: 0pt;" id="pre8" lang="cs"><span class="code-keyword">this</span>.sqlCommand1.Parameters[<span class="code-string">"</span><span class="code-string">@ID"</span>].Value=this.editID.Text;
<span class="code-keyword">this</span>.sqlCommand1.Parameters[<span class="code-string">"</span><span class="code-string">@Name"</span>].Value=this.editName.Text;

<span class="code-keyword">this</span>.sqlCommand1.Parameters[<span class="code-string">"</span><span class="code-string">@Picture"</span>].Value=this.m_barrImg;</pre>
<p>�<code lang="cs"><span class="code-keyword">this</span>.m_barrImg</code>�
 is a byte array which we filled in the previous step.</p>
</li><li>Now execute non-query for saving the record to the database. <div
 class="small-text" id="premain9" style="width: 100%; cursor: pointer;"><img
 preid="9" src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg9" 
width="9" height="9"><span preid="9" style="margin-bottom: 0pt;" 
id="precollapse9"> Collapse</span></div><pre style="margin-top: 0pt;" id="pre9" lang="cs"><span class="code-keyword">int</span> iresult=this.sqlCommand1.ExecuteNonQuery();</pre></li></ol>
<h3>Complete Save Image Code</h3><div class="small-text" id="premain10" 
style="width: 100%; cursor: pointer;"><img preid="10" 
src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg10" width="9" 
height="9"><span preid="10" style="margin-bottom: 0pt;" 
id="precollapse10"> Collapse</span></div><pre style="margin-top: 0pt;" id="pre10" lang="cs"><span class="code-keyword">private</span> <span class="code-keyword">void</span> btnSave_Click(<span class="code-keyword">object</span> sender, System.EventArgs e)
{
    <span class="code-keyword">try</span>
    {
        <span class="code-keyword">this</span>.sqlConnection1.Open();
        <span class="code-keyword">if</span> (sqlCommand1.Parameters.Count ==0 )
        {
            <span class="code-keyword">this</span>.sqlCommand1.CommandText=<span class="code-string">"</span><span class="code-string">INSERT INTO tblImgData(ID,"</span> + 
                           <span class="code-string">"</span><span class="code-string"> Name,Picture) values(@ID,@Name,@Picture)"</span>;
            <span class="code-keyword">this</span>.sqlCommand1.Parameters.Add(<span class="code-string">"</span><span class="code-string">@ID"</span>, 
                             System.Data.SqlDbType.Int,<span class="code-digit">4</span>);
            <span class="code-keyword">this</span>.sqlCommand1.Parameters.Add(<span class="code-string">"</span><span class="code-string">@Name"</span>, 
                             System.Data.SqlDbType.VarChar,<span class="code-digit">50</span>);
            <span class="code-keyword">this</span>.sqlCommand1.Parameters.Add(<span class="code-string">"</span><span class="code-string">@Picture"</span>, 
                             System.Data.SqlDbType.Image);
        }

        <span class="code-keyword">this</span>.sqlCommand1.Parameters[<span class="code-string">"</span><span class="code-string">@ID"</span>].Value=this.editID.Text;
        <span class="code-keyword">this</span>.sqlCommand1.Parameters[<span class="code-string">"</span><span class="code-string">@Name"</span>].Value=this.editName.Text;
        <span class="code-keyword">this</span>.sqlCommand1.Parameters[<span class="code-string">"</span><span class="code-string">@Picture"</span>].Value=this.m_barrImg;

        <span class="code-keyword">int</span> iresult=this.sqlCommand1.ExecuteNonQuery();
        MessageBox.Show(Convert.ToString(iresult));
    }
    <span class="code-keyword">catch</span>(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
    <span class="code-keyword">finally</span>
    {
        <span class="code-keyword">this</span>.sqlConnection1.Close();
    }
}</pre></li></ol>
<h2>Retrieving Image</h2>
<p>Retrieving images from the database is the exact reverse process of 
saving images to the database.</p>
<ol>
<li>First create command text to retrieve record. <div 
class="small-text" id="premain11" style="width: 100%; cursor: pointer;"><img
 preid="11" src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg11"
 width="9" height="9"><span preid="11" style="margin-bottom: 0pt;" 
id="precollapse11"> Collapse</span></div><pre style="margin-top: 0pt;" id="pre11" lang="cs">SqlCommand cmdSelect = <span class="code-keyword">new</span> SqlCommand(<span class="code-string">"</span><span class="code-string">select Picture"</span> + 
                       <span class="code-string">"</span><span class="code-string"> from tblImgData where ID=@ID"</span>, 
                       <span class="code-keyword">this</span>.sqlConnection1);</pre>
</li><li>Create parameter for the query. <div class="small-text" 
id="premain12" style="width: 100%; cursor: pointer;"><img preid="12" 
src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg12" width="9" 
height="9"><span preid="12" style="margin-bottom: 0pt;" 
id="precollapse12"> Collapse</span></div><pre style="margin-top: 0pt;" id="pre12" lang="cs">cmdSelect.Parameters.Add(<span class="code-string">"</span><span class="code-string">@ID"</span>,SqlDbType.Int,<span class="code-digit">4</span>);</pre>
</li><li>Provide value to the parameter. <div class="small-text" 
id="premain13" style="width: 100%; cursor: pointer;"><img preid="13" 
src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg13" width="9" 
height="9"><span preid="13" style="margin-bottom: 0pt;" 
id="precollapse13"> Collapse</span></div><pre style="margin-top: 0pt;" id="pre13" lang="cs">cmdSelect.Parameters[<span class="code-string">"</span><span class="code-string">@ID"</span>].Value=this.editID.Text;</pre>
</li><li>Open database connection and execute �<code>ExecuteScalar</code>�
 because we want only �<code>IMAGE</code>� column data back. <div 
class="small-text" id="premain14" style="width: 100%; cursor: pointer;"><img
 preid="14" src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg14"
 width="9" height="9"><span preid="14" style="margin-bottom: 0pt;" 
id="precollapse14"> Collapse</span></div><pre style="margin-top: 0pt;" id="pre14" lang="cs"><span class="code-keyword">byte</span>[] barrImg=(<span class="code-keyword">byte</span>[])cmdSelect.ExecuteScalar();</pre>
<p>As the execute scalar returns data of �<code lang="cs"><span 
class="code-SDKkeyword">Object</span></code>� data type, we cast it to <code
 lang="cs"><span class="code-keyword">byte</span></code> array.</p>
</li><li>Save this data to a temporary file. <div class="small-text" 
id="premain15" style="width: 100%; cursor: pointer;"><img preid="15" 
src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg15" width="9" 
height="9"><span preid="15" style="margin-bottom: 0pt;" 
id="precollapse15"> Collapse</span></div><pre style="margin-top: 0pt;" id="pre15" lang="cs"><span class="code-keyword">string</span> strfn=Convert.ToString(DateTime.Now.ToFileTime());
FileStream fs=new FileStream(strfn,FileMode.CreateNew,FileAccess.Write);
fs.Write(barrImg,<span class="code-digit">0</span>,barrImg.Length);
fs.Flush();
fs.Close();</pre>
</li><li>And display the image anywhere you want to display. <div 
class="small-text" id="premain16" style="width: 100%; cursor: pointer;"><img
 preid="16" src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg16"
 width="9" height="9"><span preid="16" style="margin-bottom: 0pt;" 
id="precollapse16"> Collapse</span></div><pre style="margin-top: 0pt;" id="pre16" lang="cs">pictureBox1.Image=Image.FromFile(strfn);</pre></li></ol>
<h3>Complete Image Retrieving Code</h3><div class="small-text" 
id="premain17" style="width: 100%; cursor: pointer;"><img preid="17" 
src="ImageSaveInDataBase.aspx_files/minus.gif" id="preimg17" width="9" 
height="9"><span preid="17" style="margin-bottom: 0pt;" 
id="precollapse17"> Collapse</span></div><pre style="margin-top: 0pt;" id="pre17" lang="cs"><span class="code-keyword">private</span> <span class="code-keyword">void</span> btnLoad_Click(<span class="code-keyword">object</span> sender, System.EventArgs e)
{
    <span class="code-keyword">try</span>
    {
        SqlCommand cmdSelect=new SqlCommand(<span class="code-string">"</span><span class="code-string">select Picture"</span> + 
              <span class="code-string">"</span><span class="code-string"> from tblImgData where ID=@ID"</span>,<span class="code-keyword">this</span>.sqlConnection1);
        cmdSelect.Parameters.Add(<span class="code-string">"</span><span class="code-string">@ID"</span>,SqlDbType.Int,<span class="code-digit">4</span>);
        cmdSelect.Parameters[<span class="code-string">"</span><span class="code-string">@ID"</span>].Value=this.editID.Text;

        <span class="code-keyword">this</span>.sqlConnection1.Open();
        <span class="code-keyword">byte</span>[] barrImg=(<span class="code-keyword">byte</span>[])cmdSelect.ExecuteScalar();
        <span class="code-keyword">string</span> strfn=Convert.ToString(DateTime.Now.ToFileTime());
        FileStream fs=new FileStream(strfn, 
                          FileMode.CreateNew, FileAccess.Write);
        fs.Write(barrImg,<span class="code-digit">0</span>,barrImg.Length);
        fs.Flush();
        fs.Close();
        pictureBox1.Image=Image.FromFile(strfn);
    }
    <span class="code-keyword">catch</span>(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
    <span class="code-keyword">finally</span>
    {
        <span class="code-keyword">this</span>.sqlConnection1.Close();
    }
}</pre>
<h2>Bibliography</h2>
<ul>
<li><a href="http://aspalliance.com/articleViewer.aspx?aId=140" 
target="_blank">Retrieving Images from SQL Server in ASP.NET</a> 
</li><li><a 
href="http://codebetter.com/blogs/eric.wise/archive/2005/05/15/63236.aspx"
 target="_blank">Images, Thumbnails, SQL Server, and ASP.NET - Level 200</a>
 </li></ul>






	<!-- Main Page Contents End -->
	
	</div>
	
	
	<form name="aspnetForm" method="post" action="displayarticle.aspx" 
id="aspnetForm" style="margin: 0pt; padding: 0pt;">
<div>
<input name="__VIEWSTATE" id="__VIEWSTATE" 
value="/wEPDwUKMTAyMTMzODg1Ng9kFgJmD2QWBAIJD2QWBAIFDw8WAh4HVmlzaWJsZWdkZAINDw8WAh8AZ2RkAgoPZBYKAgcPZBYMAgEPZBYCZg8WAh4LXyFJdGVtQ291bnRmZAIDD2QWCGYPDxYCHgtOYXZpZ2F0ZVVybAUzL0tCL2RhdGFiYXNlL0ltYWdlU2F2ZUluRGF0YUJhc2UuYXNweD9kaXNwbGF5PVByaW50ZGQCAg8PFgIfAGhkZAIDDw8WAh8AaGRkAgQPDxYCHwIFJi9zY3JpcHQvQXJ0aWNsZXMvUmVwb3J0LmFzcHg/YWlkPTEwODYxZGQCBQ8WAh4EbmFtZQUMQ3VyUmF0XzEwODYxFgJmD2QWAmYPZBYCZg9kFgRmD2QWAgIBDw8WAh4EVGV4dAUaNDQgdm90ZXMgZm9yIHRoaXMgYXJ0aWNsZS5kZAIDD2QWAmYPZBYEAgEPDxYEHwQFEFBvcHVsYXJpdHk6IDYuMTEfAgUpL3NjcmlwdC9BcnRpY2xlcy9Ub3BBcnRpY2xlcy5hc3B4P3RhX3NvPTFkZAIFDxYCHwQFHFJhdGluZzogPGI+My43MjwvYj4gb3V0IG9mIDVkAhkPZBYKAgEPZBYEAgEPFgIeCWlubmVyaHRtbAWxAjxwPlRoaXMgYXJ0aWNsZSBoYXMgbm8gZXhwbGljaXQgbGljZW5zZSBhdHRhY2hlZCB0byBpdCBidXQgbWF5IGNvbnRhaW4gdXNhZ2UgdGVybXMgaW4gdGhlIGFydGljbGUgdGV4dCBvciB0aGUgZG93bmxvYWQgZmlsZXMgdGhlbXNlbHZlcy4gSWYgaW4gZG91YnQgcGxlYXNlIGNvbnRhY3QgdGhlIGF1dGhvciB2aWEgdGhlIGRpc2N1c3Npb24gYm9hcmQgYmVsb3cuPC9wPjxwPkEgbGlzdCBvZiBsaWNlbnNlcyBhdXRob3JzIG1pZ2h0IHVzZSBjYW4gYmUgZm91bmQgPGEgaHJlZj0iL2luZm8vTGljZW5zZXMuYXNweCI+aGVyZTwvYT48L3A+ZAICD2QWAgIBDxBkZBYAZAIFDxYCHwECAWQCBw8WAh8EBbUJPGgyPk90aGVyIHBvcHVsYXIgRGF0YWJhc2UgYXJ0aWNsZXM6PC9oMj48dWw+PGxpPjxhIGhyZWY9Ii9LQi9kYXRhYmFzZS9jYWFhZG9jbGFzczEuYXNweCI+QSBzZXQgb2YgQURPIGNsYXNzZXMgLSB2ZXJzaW9uIDIuMjA8L2E+PGRpdiBjbGFzcz0ic21hbGwtdGV4dCI+U2ltcGxlIGRhdGFiYXNlIGFjY2VzcyB1c2luZyBhbiBBRE8gY2xhc3MuPC9kaXY+PC9saT48bGk+PGEgaHJlZj0iL0tCL2RhdGFiYXNlL2ZpbGVoZWxwZXJzLmFzcHgiPkZpbGVIZWxwZXJzIHYyLjAgLSBEZWxpbWl0ZWQgKENTVikgb3IgRml4ZWQgRGF0YSBJbXBvcnQvRXhwb3J0IEZyYW1ld29yazwvYT48ZGl2IGNsYXNzPSJzbWFsbC10ZXh0Ij5BbiBlYXN5IHRvIHVzZSAuTkVUIGxpYnJhcnkgdG8gcmVhZC93cml0ZSBzdHJvbmcgdHlwZWQgZGF0YSBmcm9tIGZpbGVzIHdpdGggZml4ZWQgbGVuZ3RoIG9yIGRlbGltaXRlZCByZWNvcmRzIChDU1YpLiBBbHNvIGhhcyBzdXBwb3J0IHRvIGltcG9ydC9leHBvcnQgZGF0YSBmcm9tIGRpZmZlcmVudCBkYXRhIHN0b3JhZ2VzIChFeGNlbCwgQWNjZXMsIFNxbFNlcnZlciwgTXlTcWwpPC9kaXY+PC9saT48bGk+PGEgaHJlZj0iL0tCL2RhdGFiYXNlL0NzdlJlYWRlci5hc3B4Ij5BIEZhc3QgQ1NWIFJlYWRlcjwvYT48ZGl2IGNsYXNzPSJzbWFsbC10ZXh0Ij5BIHJlYWRlciB0aGF0IHByb3ZpZGVzIGZhc3QsIG5vbi1jYWNoZWQsIGZvcndhcmQtb25seSBhY2Nlc3MgdG8gQ1NWIGRhdGE8L2Rpdj48L2xpPjxsaT48YSBocmVmPSIvS0IvZGF0YWJhc2Uvc3FsZG9kb250LmFzcHgiPlNRTCBTZXJ2ZXIgRE8ncyBhbmQgRE9OVCdzPC9hPjxkaXYgY2xhc3M9InNtYWxsLXRleHQiPlNRTCBTZXJ2ZXIgZGF0YWJhc2UgYmVzdCBwcmFjdGljZXM8L2Rpdj48L2xpPjxsaT48YSBocmVmPSIvS0IvZGF0YWJhc2UvRHluYW1pY01ldGhvZF9JTEdlbmVyYXRvci5hc3B4Ij5EeW5hbWljLi4uIEJ1dCBGYXN0OiBUaGUgVGFsZSBvZiBUaHJlZSBNb25rZXlzLCBBIFdvbGYgYW5kIHRoZSBEeW5hbWljTWV0aG9kIGFuZCBJTEdlbmVyYXRvciBDbGFzc2VzPC9hPjxkaXYgY2xhc3M9InNtYWxsLXRleHQiPkhvdyB0byB1c2UgdGhlIER5bmFtaWNNZXRob2QgYW5kIElMR2VuZXJhdG9yIGNsYXNzZXMgdG8gY3JlYXRlIGR5bmFtaWMgY29kZSBhdCBydW50aW1lIHRoYXQgb3V0cGVyZm9ybXMgcmVmbGVjdGlvbjwvZGl2PjwvbGk+PC91bD5kAgsPDxYCHwBnZGQCDQ9kFgJmD2QWAgIBD2QWAmYPZBYCZg8WBB8DBQ5SYXRlSXRlbV8xMDg2MR4FY2xhc3NlFgYCBA8WAh8AaBYCAgEPEGRkFgBkAgUPFgIfAGhkAgYPFgIfAGgWAgIBDw9kFgIeB29uY2xpY2sFI3JldHVybiByYXRlSXRlbSgxMDg2MSwyLHRydWUsdHJ1ZSk7ZAIbDw8WAh8AZ2RkAiEPFgIfAGhkAgsPDxYCHwIFJy9zY3JpcHQvQXJ0aWNsZXMvQXJ0aWNsZS5hc3B4P2FpZD0xMDg2MWRkAhEPFgIfBAULMzAgSnVuIDIwMDVkAhMPDxYEHwQFDlNtaXRoYSBWaWpheWFuHwIFJi9zY3JpcHQvTWVtYmVyc2hpcC9WaWV3LmFzcHg/bWlkPTI4OTcwZGQCFQ8WAh8EBSRDb3B5cmlnaHQgMjAwNSBieSBLYXppbSBTYXJkYXIgTWVoZGlkZO/dO26+QDxIqvVufQNFEnrjtyi5"
 type="hidden">
</div>


	
	<h2>License</h2>
	<div id="ctl00_LicenseTerms"><p>This article has no explicit license 
attached to it but may contain usage terms in the article text or the 
download files themselves. If in doubt please contact the author via the
 discussion board below.</p><p>A list of licenses authors might use can 
be found <a href="http://www.codeproject.com/info/Licenses.aspx">here</a></p></div>
	
	<h2>About the Author</h2>
	
			
   
        
<table width="100%" border="0" cellpadding="0" cellspacing="5">
<tbody><tr valign="top">
<td id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberPhotoTable" 
style="width: 155px;" valign="top">
	<b><a id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberProfileLink" 
href="http://www.codeproject.com/Members/Kazim-Sardar-Mehdi">Kazim 
Sardar Mehdi</a></b><br><br>
	<center></center><br>
	<span id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberType" 
class="small-text">Member</span>		
</td>

<td>
	<br>	

	<table>
	<tbody><tr id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_jobTitleRow">
	<td class="small-text" nowrap="nowrap">Occupation: </td>
	<td width="100%"><span 
id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberJobTitle" 
class="small-text">Web Developer</span></td>
</tr>


	

	<tr id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_locationRow">
	<td class="small-text">Location: </td>
	<td width="100%"><span 
id="ctl00_AboutAuthorRptr_ctl00_AboutAuthor_memberLocation" 
class="small-text"><img src="ImageSaveInDataBase.aspx_files/SE.gif" 
alt="Sweden" width="16px" height="11px"> Sweden</span></td>
</tr>

	</tbody></table>
	</td>
	</tr>
	</tbody></table>


			<br>
		
	
	<table width="100%" border="0" cellpadding="0" cellspacing="0">	
	<tbody><tr valign="top">			
		<td style="width: 100%;">
			<h2>Other popular Database articles:</h2><ul><li><a 
href="http://www.codeproject.com/KB/database/caaadoclass1.aspx">A set of
 ADO classes - version 2.20</a><div class="small-text">Simple database 
access using an ADO class.</div></li><li><a 
href="http://www.codeproject.com/KB/database/filehelpers.aspx">FileHelpers
 v2.0 - Delimited (CSV) or Fixed Data Import/Export Framework</a><div 
class="small-text">An easy to use .NET library to read/write strong 
typed data from files with fixed length or delimited records (CSV). Also
 has support to import/export data from different data storages (Excel, 
Acces, SqlServer, MySql)</div></li><li><a 
href="http://www.codeproject.com/KB/database/CsvReader.aspx">A Fast CSV 
Reader</a><div class="small-text">A reader that provides fast, 
non-cached, forward-only access to CSV data</div></li><li><a 
href="http://www.codeproject.com/KB/database/sqldodont.aspx">SQL Server 
DO's and DONT's</a><div class="small-text">SQL Server database best 
practices</div></li><li><a 
href="http://www.codeproject.com/KB/database/DynamicMethod_ILGenerator.aspx">Dynamic...
 But Fast: The Tale of Three Monkeys, A Wolf and the DynamicMethod and 
ILGenerator Classes</a><div class="small-text">How to use the 
DynamicMethod and ILGenerator classes to create dynamic code at runtime 
that outperforms reflection</div></li></ul>
			
		</td>
		<td>
			<div id="ctl00_AdWords" style="display: inline-block; width: 300px; 
height: 250px;" title=""><iframe 
src="ImageSaveInDataBase.aspx_files/ServeHtml_002.htm" width="300px" 
frameborder="0" height="250px" scrolling="no"></iframe></div>						 
		</td>
	</tr>
	</tbody></table>

	<table id="ctl00_RateArticleRow" class="RatingBar" width="100%" 
border="0" cellpadding="0" cellspacing="0">
	<tbody><tr>
		<td><a href="#_top">Article Top</a></td>
		<td align="right"><div id="ctl00_RateArticle_RateItemWrapper" style=""
 name="RateItem_10861" class="">

<table width="100%" cellpadding="0" cellspacing="0">
<tbody><tr>
	
	
	<td class="voteTbl" style="white-space: nowrap;" align="right">
		<table class="">
		<tbody><tr valign="middle">
			<td id="ctl00_RateArticle_SignIn" nowrap="nowrap">
				<a href="#SignUp">Sign Up</a> to vote for this article
			</td>
		
			
			
			
			
			
		</tr>
		</tbody></table>
		<span id="ctl00_RateArticle_ErrorMessage"></span>
	</td>
</tr>
</tbody></table>

<div class="RateComDiv" id="RCD" style="display: none;">
	<table width="100%"><tbody><tr valign="top"><td width="100%" 
align="right">Your reason for this vote:</td>
	<td><textarea class="RateComment" rows="5" cols="60" style="width: 
285px; float: right;"></textarea>
	</td></tr></tbody></table>
</div>

</div>
</td>
	</tr>
</tbody></table>

	</form>
	
	<div style="margin-left: 40px; padding: 10px; white-space: nowrap; 
overflow: hidden;">		  
		<script type="text/javascript">document.write(unescape("%3ca%20href%3d%22http%3a%2f%2fwww.codeproject.com%2fRedir.aspx%3fadid%3d13169%26adcrid%3d11649%26obid%3d10861%26obtid%3d2%26way%3dban%22%20target%3d%22_blank%22%20rel%3d%22nofollow%22%3e%3cimg%20id%3d%22ctl00_BottomAd%22%20src%3d%22%2fimages%2ft.gif%22%20width%3d%22468px%22%20height%3d%2260px%22%20alt%3d%22%22%20border%3d%220%22%2f%3e%3c%2fa%3e"));</script><a
 
href="http://www.codeproject.com/Redir.aspx?adid=13169&amp;adcrid=11649&amp;obid=10861&amp;obtid=2&amp;way=ban"
 target="_blank" rel="nofollow"><img id="ctl00_BottomAd" 
src="ImageSaveInDataBase.aspx_files/ServeImg.gif" alt="" width="468px" 
border="0" height="60px"></a>
		
	</div>

	<a name="_comments"></a><!-- Forum Start -->
<div id="_MessageBoard" onclick="return SwitchMessage(event, null)">
	<table id="ForumTable" class="box theme3-background theme1-border 
fixed-layout tight" cellpadding="0" cellspacing="0">
		<tbody><tr>
			<td class="forum-header1 highlight"><b>You must <a 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx%3ffid%3d194674%26df%3d90%26mpp%3d25%26noise%3d3%26sort%3dPosition%26view%3dQuick">Sign
 In</a> to use this message board.</b></td>
		</tr><tr>
			<td><table width="100%" border="0" cellpadding="3px" cellspacing="0">
				<tbody><tr class="forum-header1">
					<td style="white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/forum_faq.gif" alt="FAQ" 
width="16px" align="middle" border="0" height="16px">&nbsp;<a 
href="http://www.codeproject.com/KB/FAQs/MessageBoardsFAQ.aspx"><b>FAQ</b></a>&nbsp;</td><td
 colspan="2" style="white-space: nowrap; text-align: right;"><form 
action="/script/Forums/Search.aspx?fid=0" method="get" style="margin: 
0pt; padding: 0pt;">
						<input name="fid" value="194674" type="hidden"><input 
class="Frm_Input" name="kw" type="text">&nbsp;<input value="Search" 
name="FrmSrch" class="button" type="submit">
					</form></td>
				</tr><tr class="forum-header2">
					<td colspan="3" style="width: 100%;"><div style="text-align: 
right;">
						<form 
action="/script/Forums/SetOptions.aspx?floc=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx&amp;fid=194674&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick"
 method="get" style="margin: 0pt; padding: 0pt;">
							<input name="fid" value="194674" type="hidden"><input 
name="currentQS" 
value="?floc=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx&amp;fid=194674&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick"
 type="hidden"><input name="floc" 
value="/KB/database/ImageSaveInDataBase.aspx" type="hidden">Noise 
Tolerance<select size="1" class="Frm_DropDown" name="noise">
								<option value="1">Very High</option><option value="2">High</option><option
 selected="selected" value="3">Medium</option><option value="4">Low</option><option
 value="5">Very Low</option>
							</select>&nbsp;&nbsp;Layout<select size="1" class="Frm_DropDown" 
name="view">
								<option selected="selected" value="Quick">Normal</option><option
 value="Topic">Expand Posts only</option><option value="Expanded">Expand
 Posts &amp; Replies</option><option value="Thread">Thread View</option><option
 value="Normal">No Javascript</option><option value="Preview">No JS + 
Preview</option>
							</select>&nbsp;&nbsp;Per page<select size="1" 
class="Frm_DropDown" name="mpp">
								<option value="10">10</option><option selected="selected" 
value="25">25</option><option value="50">50</option>
							</select>&nbsp;&nbsp;&nbsp;<input value="Update" name="SetOpt" 
class="button" type="submit">
						</form>
					</div></td>
				</tr>
			</tbody></table></td>
		</tr><tr>
			<td><a name="xx0xx"></a><table width="100%" border="0" 
cellpadding="2px" cellspacing="0">
				<tbody><tr class="forum-navbar">
					<td>&nbsp;</td><td>Msgs 1 to 25 of 38 (Total in Forum: 38) (<a 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick">Refresh</a>)</td><td
 style="text-align: right; white-space: nowrap;"><span class="toolbar">First</span><span
 class="toolbar">Prev</span><a class="toolbar" name="Frm_HoverNL" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;fr=26#xx0xx">Next</a></td>
				</tr>
			</tbody></table></td>
		</tr><tr>
			<td><table class="fixed-layout blank-background" width="100%" 
border="0" cellpadding="0" cellspacing="0">
				<tbody><tr>
					<td><img src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" 
width="1px" border="0" height="5px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd Rt HdUnSel " id="F3289211_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx3289211xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="3289211" 
href="http://www.codeproject.com/Messages/3289211/Nice.aspx">Nice</a> <a
 onclick="return Pin(this);" href="#" title="Click to pin message"><img 
src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=4187012">Nitin
 Sawant</a></td><td class="Frm_MsgDate" style="vertical-align: top; 
white-space: nowrap;">19:42 30 Nov '09 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F3289211_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">Thanks a lot  <img 
src="ImageSaveInDataBase.aspx_files/smiley_biggrin.gif" alt="Big Grin" 
align="top">  <br><br><div class="ForumSig">=============<br>NITIN 
SAWANT<br>=============</div><br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=3289211"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/3289211/Nice.aspx" title="Get 
permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF3289211" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd Rt HdUnSel " id="F3188185_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx3188185xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="3188185" 
href="http://www.codeproject.com/Messages/3188185/How-Do-I-delete-the-temporary-files-created.aspx">How
 Do I delete the temporary files created?</a> <a onclick="return 
Pin(this);" href="#" title="Click to pin message"><img 
src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=6515518">NastyJoe</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">5:53
 7 Sep '09 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F3188185_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">Hi<br><br>This is a nice post, I have got 
everything working except for the fact that it creates temporary files, 
how do I delete them? I have tried a few techniques and end up with an 
error saying<br><br>Additional information: The process cannot access 
the file "C:\???\ImageSaveInDataBase\bin\Debug\128968083431232299" 
because it is being used by another process.<br><br>It creates temporary
 files when loading and when retrieving.<br><br>NB.<br>if(File.Exists(fs.Name))<br>{<br>File.Delete(fs.Name);
 --Exception caused here<br>}<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=3188185"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/3188185/How-Do-I-delete-the-temporary-files-created.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF3188185" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd Rt HdUnSel " id="F3177002_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx3177002xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="3177002" 
href="http://www.codeproject.com/Messages/3177002/Thank-you-kazim-Sir.aspx">Thank
 you kazim Sir</a> <a onclick="return Pin(this);" href="#" title="Click 
to pin message"><img src="ImageSaveInDataBase.aspx_files/pin.gif" 
alt="Pin" width="13px" align="top" border="0" height="12px"></a></td><td
 style="width: 20px; white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=5130534">rahulxlash</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">2:07
 28 Aug '09 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F3177002_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">You saved me<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=3177002"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/3177002/Thank-you-kazim-Sir.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF3177002" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd Rt HdUnSel " id="F3165387_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx3165387xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="3165387" 
href="http://www.codeproject.com/Messages/3165387/Nice-post-modified.aspx">Nice
 post! [modified]</a> <a onclick="return Pin(this);" href="#" 
title="Click to pin message"><img 
src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=4915224">CrazyTasty</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">21:30
 18 Aug '09 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F3165387_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">I modified the .sql script a bit and then ran
 it.  I then added my connection string to the app.config file.<br>I ran
 the app and was able to save and load from SQL Express, SQL 2005 AND 
SQL 2008. <br><br>I cut &amp; pasted the part of the code I needed, 
modified the code and params a bit to match my table and I was up and 
running in no time. This little article saved me some time for sure. <br><br>Worked
 like a charm for my ASP.NET administration page for loading images.<br><br>Thanks
 dude.<br><br>-CrazyTasty<br><br>p.s. If we need to save and load large 
image sizes, make sure memory is allocated correctly and objects are 
destroyed immediately after use.<br><br>p.s.s. Cleaning up the temp 
file(s) can be done a number of ways. Either use an InterOp method for 
grabbing the handle and removing it that way, or remove anything with 0 
bytes when exiting the program.<br><br>p.s.s. Also, if we are to store 
and retrieve a lot of images (where some are large maybe) across the 
network and tiers alike, storing images all together is probably a bad 
idea due to possible performance issues. There are definitely Pros and 
Cons out there to be aware of. <br><br><div class="ForumMod">modified on
 Wednesday, August 19, 2009 2:45 AM</div><br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=3165387"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/3165387/Nice-post-modified.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF3165387" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd Rt HdUnSel " id="F3134346_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx3134346xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="3134346" 
href="http://www.codeproject.com/Messages/3134346/Thank-you-very-much.aspx">Thank
 you very much</a> <a onclick="return Pin(this);" href="#" title="Click 
to pin message"><img src="ImageSaveInDataBase.aspx_files/pin.gif" 
alt="Pin" width="13px" align="top" border="0" height="12px"></a></td><td
 style="width: 20px; white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=4215125">hamid_ss</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">11:16
 25 Jul '09 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F3134346_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">This article helped me so much<br>Thank you<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=3134346"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/3134346/Thank-you-very-much.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF3134346" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd Rt HdUnSel " id="F3031862_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx3031862xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="3031862" 
href="http://www.codeproject.com/Messages/3031862/similar-code-in-net-2003-and-sql-2000.aspx">similar
 code in .net 2003 and sql 2000</a> <a onclick="return Pin(this);" 
href="#" title="Click to pin message"><img 
src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=6092669">sanjaydsm1676</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">1:27
 7 May '09 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F3031862_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">Can you help me in writing the similar code 
in .net 2003<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=3031862"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/3031862/similar-code-in-net-2003-and-sql-2000.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF3031862" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd LoVote Rt HdUnSel " id="F2891101_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2891101xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2891101" 
href="http://www.codeproject.com/Messages/2891101/My-vote-of-2.aspx">My 
vote of 2</a> <a onclick="return Pin(this);" href="#" title="Click to 
pin message"><img src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin"
 width="13px" align="top" border="0" height="12px"></a></td><td 
style="width: 20px; white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=5530076">maroju.raghava</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">22:40
 21 Jan '09 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2891101_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">aaaaaaaaa<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2891101"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2891101/My-vote-of-2.aspx" 
title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2891101" style="white-space: 
nowrap;">1.00/5 (1 vote) </span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd Rt HdUnSel " id="F2891096_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2891096xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2891096" 
href="http://www.codeproject.com/Messages/2891096/My-vote-of-2.aspx">My 
vote of 2</a> <a onclick="return Pin(this);" href="#" title="Click to 
pin message"><img src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin"
 width="13px" align="top" border="0" height="12px"></a></td><td 
style="width: 20px; white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=5530076">maroju.raghava</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">22:38
 21 Jan '09 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2891096_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">the code is useful to me<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2891096"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2891096/My-vote-of-2.aspx" 
title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2891096" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd Rt HdUnSel " id="F2789110_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2789110xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_news.gif" alt="News" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2789110" 
href="http://www.codeproject.com/Messages/2789110/sql-server-related-interesting-articles-modified.aspx">sql
 server related interesting articles [modified]</a> <a onclick="return 
Pin(this);" href="#" title="Click to pin message"><img 
src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=5497451">codemobile</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">20:57
 31 Oct '08 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2789110_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">visit this <a 
href="http://developrtassistant.blogspot.com/2008/12/storing-and-retrieving-images-from-sql.html">http://developerassistant.blogspot.com/2008/12/storing-and-retrieving-images-from-sql.html</a>[<a
 
href="http://developerassistant.blogspot.com/2008/12/storing-and-retrieving-images-from-sql.html"
 target="_blank" title="New Window">^</a>] for other more articles. <br><br><div
 class="ForumMod">modified on Sunday, November 30, 2008 1:56 AM</div><br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2789110"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2789110/sql-server-related-interesting-articles-modified.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2789110" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd LoVote Rt HdUnSel " id="F2669805_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2669805xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_question.gif" alt="Question" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2669805" 
href="http://www.codeproject.com/Messages/2669805/Error-Checking.aspx">Error
 Checking</a> <a onclick="return Pin(this);" href="#" title="Click to 
pin message"><img src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin"
 width="13px" align="top" border="0" height="12px"></a></td><td 
style="width: 20px; white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=5213411">PTTAN</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">21:56
 7 Aug '08 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2669805_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">How can i do error checking for Save image, 
for example, the name is already used. So how can i do checking for the 
database?<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2669805"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2669805/Error-Checking.aspx" 
title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2669805" style="white-space: 
nowrap;">2.00/5 (1 vote) </span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd LoVote Rt HdUnSel " id="F2648174_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2648174xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2648174" 
href="http://www.codeproject.com/Messages/2648174/this-code-works-fine-but-it-inserts-null-value-in-.aspx">this
 code works fine but it inserts null value in to the database...........</a>
 <a onclick="return Pin(this);" href="#" title="Click to pin message"><img
 src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=5233902">kkwaghpriya</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">19:26
 22 Jul '08 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2648174_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">hi,thanks the code works really fine <br><br><br>but
 I have an issue........ <br>I hv a table with photo as a column with 
image datatype in sqlserver2005<br>Now the code below is used to save 
the image in this column actually record for the student has already 
been inserted now i want to only update this field..<br>        <br>ssql
 = "update Students set Photo=@Pic where ID='2' <br>        
cmd.CommandText = ssql<br>        
cmd.Parameters.Add("@Pic",System.Data.SqlDbType.Image)<br>        
cmd.Parameters.Item("@Pic").Value = barrImg<br>        
cmd.ExecuteNonQuery()<br><br><br>This code does execute without any 
error but it inserts null value..<br>The variable barrimg has the same 
sense that is represented in this code.<br><br><br>please help me out as
 where am I going wrng.........<br>Its URGENT........... :<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2648174"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2648174/this-code-works-fine-but-it-inserts-null-value-in-.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2648174" style="white-space: 
nowrap;">1.00/5 (1 vote) </span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd LoVote Rt HdUnSel " id="F2614719_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2614719xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2614719" 
href="http://www.codeproject.com/Messages/2614719/Export-Gridview-data-to-sql-database-table.aspx">Export
 Gridview data to sql database table</a> <a onclick="return Pin(this);" 
href="#" title="Click to pin message"><img 
src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=3599976">naresh1507</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">0:10
 27 Jun '08 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2614719_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">Hi<br>I am facing a problem, i have a 
gridview and i want to add gridview's data to sql server database table.
 how can it possible.<br><br>thanx<br>naresh rajput<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2614719"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2614719/Export-Gridview-data-to-sql-database-table.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2614719" style="white-space: 
nowrap;">2.00/5 (1 vote) </span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd HdUnSel " id="F2833664_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="34px"><a name="xx2833664xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2833664" 
href="http://www.codeproject.com/Messages/2833664/Re-Export-Gridview-data-to-sql-database-table.aspx">Re:
 Export Gridview data to sql database table</a> <a onclick="return 
Pin(this);" href="#" title="Click to pin message"><img 
src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=5714614">Deepsoftindia</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">0:32
 6 Dec '08 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2833664_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 34px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="34px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">I m also facing same problem like that.<br><br>anyone
 can help plz <img 
src="ImageSaveInDataBase.aspx_files/smiley_rolleyes.gif" alt="Roll eyes"
 align="top"> <br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2614719"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2833664/Re-Export-Gridview-data-to-sql-database-table.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2833664" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd LoVote Rt HdUnSel " id="F2608491_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2608491xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2608491" 
href="http://www.codeproject.com/Messages/2608491/Problem-regarding-viewing-of-images-from-sql.aspx">Problem
 regarding viewing of images from sql</a> <a onclick="return Pin(this);"
 href="#" title="Click to pin message"><img 
src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=3599976">naresh1507</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">2:31
 23 Jun '08 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2608491_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">hi sir,<br>this code workds fine but have 
some difficulties. whenever i want to see the imaged it display a 
message "C:documents and setteing/..../ file already exists". and  it is
 becoze when we view a photo then a temporary file is created 
autometically. please tell me how to solve this problem and how to 
delete autometically the file which is created autometically.<br><br>thanks<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2608491"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2608491/Problem-regarding-viewing-of-images-from-sql.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2608491" style="white-space: 
nowrap;">2.00/5 (3 votes) </span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd LoVote Rt HdUnSel " id="F2337874_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2337874xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2337874" 
href="http://www.codeproject.com/Messages/2337874/Save-code.aspx">Save 
code</a> <a onclick="return Pin(this);" href="#" title="Click to pin 
message"><img src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" 
width="13px" align="top" border="0" height="12px"></a></td><td 
style="width: 20px; white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=869269">honeybone</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">12:10
 27 Nov '07 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2337874_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">Replace the following lines<br><br>string 
strfn=Convert.ToString(DateTime.Now.ToFileTime());<br>FileStream fs=new 
FileStream(strfn,FileMode.CreateNew, FileAccess.Write);<br>fs.Write(barrImg,0,barrImg.Length);<br>fs.Flush();<br>fs.Close();<br>pictureBox1.Image=Image.FromFile(strfn);<br><br>With
 the following line using the memory stream no need to incur the 
overhead of writing to disk and reading from disk.<br><br>pictureBox1.Image=Image.FromStream(new
 MemoryStream(barrImg)); <br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2337874"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2337874/Save-code.aspx" 
title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2337874" style="white-space: 
nowrap;">2.00/5 (1 vote) </span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd HdUnSel " id="F2609568_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="34px"><a name="xx2609568xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2609568" 
href="http://www.codeproject.com/Messages/2609568/Re-Save-code.aspx">Re:
 Save code</a> <a onclick="return Pin(this);" href="#" title="Click to 
pin message"><img src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin"
 width="13px" align="top" border="0" height="12px"></a></td><td 
style="width: 20px; white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=3599976">naresh1507</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">19:55
 23 Jun '08 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2609568_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 34px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="34px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">hi <br>This is naresh, thanx for the 
solution. my problem have been solved.<br>Once again very thanx.<br>Naresh
 Rajput<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2337874"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2609568/Re-Save-code.aspx" 
title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2609568" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd HdUnSel " id="F2614714_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="34px"><a name="xx2614714xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2614714" 
href="http://www.codeproject.com/Messages/2614714/Re-Save-code.aspx">Re:
 Save code</a> <a onclick="return Pin(this);" href="#" title="Click to 
pin message"><img src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin"
 width="13px" align="top" border="0" height="12px"></a></td><td 
style="width: 20px; white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=3599976">naresh1507</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">0:09
 27 Jun '08 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2614714_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 34px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="34px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">Thanx friend,<br>This is naresh again, i have
 a problem again, could you please help me this time, i have a gridview 
and i want transfer its data to sql server database table.How can it 
possible.<br><br>thanx<br>Naresh Rajput<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2337874"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2614714/Re-Save-code.aspx" 
title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2614714" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd LoVote Rt HdUnSel " id="F2283647_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2283647xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2283647" 
href="http://www.codeproject.com/Messages/2283647/Please-help-not-working-with-2005.aspx">Please
 help, not working with 2005</a> <a onclick="return Pin(this);" href="#"
 title="Click to pin message"><img 
src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=4221457">Ferrari_X</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">13:42
 22 Oct '07 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2283647_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">Hi,<br><br>would someone please help me?<br><br>I
 cannot get it to work.  Currently I have MS SQL Server 2005 Express 
installed.<br><br>I get this message when I click on save or load<br>"The
 ConnectionString property has not been initialized".<br><br>Someone 
please post or send me the sql 2005 database file for this code.<br><br>Thank
 you very much.<img 
src="ImageSaveInDataBase.aspx_files/smiley_biggrin.gif" alt="Big Grin" 
align="top"> <br><br>-Ken <br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2283647"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2283647/Please-help-not-working-with-2005.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2283647" style="white-space: 
nowrap;">1.00/5 (2 votes) </span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd LoVote HdUnSel " id="F2609530_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="34px"><a name="xx2609530xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2609530" 
href="http://www.codeproject.com/Messages/2609530/Re-Please-help-not-working-with-2005.aspx">Re:
 Please help, not working with 2005</a> <a onclick="return Pin(this);" 
href="#" title="Click to pin message"><img 
src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=3599976">naresh1507</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">19:19
 23 Jun '08 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2609530_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 34px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="34px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">hi friend,<br><br>this is naresh from 
chandigarh. the solution of your problem is given below:<br>dim conn as 
sqlconnection<br><br>and when u have to run cmd(Sql command) before this
 you should open the connection property of the sql server, for example:<br><br>conn.open()<br><br>mention
 above line and you will find your problem vanish.<br><br>Naresh Rajput<br>Software
 Engineer<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2283647"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2609530/Re-Please-help-not-working-with-2005.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2609530" style="white-space: 
nowrap;">2.00/5 (1 vote) </span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd Rt HdUnSel " id="F2185519_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2185519xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2185519" 
href="http://www.codeproject.com/Messages/2185519/this-code-works-well-but-a-few-issues.aspx">this
 code works well, but a few issues...</a> <a onclick="return Pin(this);"
 href="#" title="Click to pin message"><img 
src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=1521840">roger_27</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">7:28
 16 Aug '07 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2185519_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">this code works great. awesome job. but I 
have 2 comments to make.<br><br>1.for those of you wanting to use this 
on a smaller scale (like if you only want to store a small image or 
avatar) you can replace filstream with MemoryStream, which puts the 
image into memory.<br><br>2. how does one delete the temporary file you 
create when reading the data again? I tried<br><br>                    
if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + fs.Name))<br>   
                 {<br>                        
File.Delete(AppDomain.CurrentDomain.BaseDirectory + fs.Name);<br>       
             }<br><br>and it doesnt work. anyways good job on the ocde. <br><br><div
 class="ForumSig">It's not a bug it's a f- oh wait... no..It's a bug.</div><br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2185519"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2185519/this-code-works-well-but-a-few-issues.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2185519" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd HdUnSel " id="F2185605_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="34px"><a name="xx2185605xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2185605" 
href="http://www.codeproject.com/Messages/2185605/Re-this-code-works-well-but-a-few-issues.aspx">Re:
 this code works well, but a few issues...</a> <a onclick="return 
Pin(this);" href="#" title="Click to pin message"><img 
src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=1521840">roger_27</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">8:20
 16 Aug '07 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2185605_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 34px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="34px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">OIC you dont need 
Appdomain.currentdomain.basedirectory<br><br>just<br>if(File.Exists(fs.Name))<br>{<br>File.Delete;<br>}
 <br><br><div class="ForumSig">It's not a bug it's a f- oh wait... 
no..It's a bug.</div><br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2185519"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2185605/Re-this-code-works-well-but-a-few-issues.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2185605" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd LoVote Rt HdUnSel " id="F2064112_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2064112xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_question.gif" alt="Question" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2064112" 
href="http://www.codeproject.com/Messages/2064112/Problem-in-Conversion-From-System-Drawing-Image-to.aspx">Problem
 in Conversion From System....Drawing.Image to System...WebControl.Image</a>
 <a onclick="return Pin(this);" href="#" title="Click to pin message"><img
 src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" width="13px" 
align="top" border="0" height="12px"></a></td><td style="width: 20px; 
white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=3974658">nareshgoradara</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">22:25
 1 Jun '07 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2064112_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2"><br><br>I am using this code in web 
application so I am using Web Controls for displaying the Image So the 
conversion Problem is occured..........<br><br>Is there any 
solution........... <br><br>Naresh Patel<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2064112"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2064112/Problem-in-Conversion-From-System-Drawing-Image-to.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2064112" style="white-space: 
nowrap;">1.60/5 (4 votes) </span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd LoVote Rt HdUnSel " id="F2044756_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2044756xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2044756" 
href="http://www.codeproject.com/Messages/2044756/Image-Storage.aspx">Image
 Storage</a> <a onclick="return Pin(this);" href="#" title="Click to pin
 message"><img src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin" 
width="13px" align="top" border="0" height="12px"></a></td><td 
style="width: 20px; white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=3089447">samshah512</a></td><td
 class="Frm_MsgDate" style="vertical-align: top; white-space: nowrap;">7:18
 19 May '07 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2044756_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">Hi <br><br> I am in a process of storing 
image in the database in binary and then retriveing the image from the 
database in orignal form.<br><br>I would appreciate if someone could 
help.<br><br>Thanks,<br>Ali <br><br>Life is too short to be counted, 
enjoy life.<br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2044756"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2044756/Image-Storage.aspx" 
title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2044756" style="white-space: 
nowrap;">2.60/5 (4 votes) </span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd LoVote HdUnSel " id="F2045772_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="34px"><a name="xx2045772xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2045772" 
href="http://www.codeproject.com/Messages/2045772/Re-Image-Storage.aspx">Re:
 Image Storage</a> <a onclick="return Pin(this);" href="#" title="Click 
to pin message"><img src="ImageSaveInDataBase.aspx_files/pin.gif" 
alt="Pin" width="13px" align="top" border="0" height="12px"></a></td><td
 style="width: 20px; white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=1539279">Kazim
 Sardar Mehdi</a></td><td class="Frm_MsgDate" style="vertical-align: 
top; white-space: nowrap;">19:52 20 May '07 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2045772_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 34px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="34px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">why dont u use this article for your 
reference, i hope it will help u alot.<br><br><br>regards<br><br>kazim 
mehdi<br> <br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2044756"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2045772/Re-Image-Storage.aspx"
 title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2045772" style="white-space: 
nowrap;">2.00/5 (2 votes) </span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr class="quick">
					<td class="root msg-divide"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="1px" 
border="0" height="1px"></td>
				</tr>
<!-- Start Message head -->

				<tr class="MsgHd Rt HdUnSel " id="F2003856_h0">
					<td width="100%"><table class="quickHd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr class="hover-row">
							<td class="Frm_MsgIndent" width="16px"><a name="xx2003856xx"></a><img
 src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"></td><td class="Frm_MsgSubject 
hover-container"><a id="DynMessLink" name="2003856" 
href="http://www.codeproject.com/Messages/2003856/NIce-Artilce.aspx">NIce
 Artilce.</a> <a onclick="return Pin(this);" href="#" title="Click to 
pin message"><img src="ImageSaveInDataBase.aspx_files/pin.gif" alt="Pin"
 width="13px" align="top" border="0" height="12px"></a></td><td 
style="width: 20px; white-space: nowrap;"><img 
src="ImageSaveInDataBase.aspx_files/member_sm.gif" title="member" 
alt="member" border="0" height="16px"></td><td class="Frm_MsgAuthor"><a 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=2040111">Chirag
 R Darji</a></td><td class="Frm_MsgDate" style="vertical-align: top; 
white-space: nowrap;">1:10 24 Apr '07 &nbsp;</td>
						</tr>
					</tbody></table></td>
				</tr><!-- End Message head -->

				<tr id="F2003856_h1" style="display: none;">
					<td width="100%"><table class="quickBd" width="100%" border="0" 
cellpadding="0" cellspacing="0">
						<tbody><tr>
							<td class="Frm_MsgIndent" style="width: 16px;"><img 
src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" width="16px" 
height="1px"></td><td class="MsgBd BdSel "><table width="100%" 
border="0" cellpadding="0" cellspacing="5px">
								<tbody><tr>
									<td><table width="100%" border="0" cellpadding="0" 
cellspacing="0">
										<tbody><tr>
											<td colspan="2">you can find Another simple example at <br><br><a
 
href="http://chiragrdarji.wordpress.com/2007/03/05/storing-and-retrieving-image-in-sql-server/">http://chiragrdarji.wordpress.com/2007/03/05/storing-and-retrieving-image-in-sql-server/</a>[<a
 
href="http://chiragrdarji.wordpress.com/2007/03/05/storing-and-retrieving-image-in-sql-server/"
 target="_blank" title="New Window">^</a>] <br><br><div class="ForumSig">Chirag
 Darji<br>Team Lead (MCP)<br>http://chiragrdarji.wordpress.com</div><br></td>
										</tr><tr style="vertical-align: middle;">
											<td class="msg-footer"><a class="toolbar" 
href="http://www.codeproject.com/script/Membership/LogOn.aspx?rp=%2fKB%2fdatabase%2fImageSaveInDataBase.aspx">Sign
 In</a>·<a class="toolbar" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;sort=Position&amp;tid=2003856"
 title="View&nbsp;Thread">View&nbsp;Thread</a>·<a class="toolbar" 
href="http://www.codeproject.com/Messages/2003856/NIce-Artilce.aspx" 
title="Get permanent link">PermaLink</a></td><td class="msg-footer" 
style="text-align: right;"><span id="MVF2003856" style="white-space: 
nowrap;"></span></td>
										</tr>
									</tbody></table></td>
								</tr>
							</tbody></table></td>
						</tr>
					</tbody></table></td>
				</tr><tr>
					<td><img src="ImageSaveInDataBase.aspx_files/t_002.gif" alt="" 
width="1px" border="0" height="5px"></td>
				</tr>
			</tbody></table></td>
		</tr><tr>
			<td><table width="100%" cellpadding="2px" cellspacing="0">
				<tbody><tr class="forum-footer">
					<td>Last Visit: 1:29 29 Mar '10  &nbsp; &nbsp; Last Update: 1:29 29
 Mar '10 </td><td style="text-align: right; white-space: nowrap;"><input
 id="_mbnUrl" 
value="/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;fr=26"
 type="hidden"><b>1</b><a class="toolbar" name="Frm_HoverNL" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;fr=26#xx0xx">2</a>
 <a class="toolbar" name="Frm_HoverNL" 
href="http://www.codeproject.com/KB/database/ImageSaveInDataBase.aspx?fid=194674&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;fr=26#xx0xx">Next
 »</a></td>
				</tr>
			</tbody></table></td>
		</tr>
	</tbody></table>
</div><p class="small-text"><img 
src="ImageSaveInDataBase.aspx_files/msg_general.gif" alt="General" 
width="16px" align="top" height="16px"> General &nbsp;&nbsp; <img 
src="ImageSaveInDataBase.aspx_files/msg_news.gif" alt="News" 
width="16px" align="top" height="16px"> News &nbsp;&nbsp; <img 
src="ImageSaveInDataBase.aspx_files/msg_question.gif" alt="Question" 
width="16px" align="top" height="16px"> Question &nbsp;&nbsp; <img 
src="ImageSaveInDataBase.aspx_files/msg_answer.gif" alt="Answer" 
width="16px" align="top" height="16px"> Answer &nbsp;&nbsp; <img 
src="ImageSaveInDataBase.aspx_files/msg_joke.gif" alt="Joke" 
width="16px" align="top" height="16px"> Joke &nbsp;&nbsp; <img 
src="ImageSaveInDataBase.aspx_files/msg_rant.gif" alt="Rant" 
width="16px" align="top" height="16px"> Rant &nbsp;&nbsp; <img 
src="ImageSaveInDataBase.aspx_files/msg_admin.gif" alt="Admin" 
width="16px" align="top" height="16px"> Admin &nbsp;&nbsp; </p><p 
class="small-text">Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down 
to switch threads, Ctrl+PgUp/PgDown to switch pages.</p>
<!-- Forum End -->




	
	</div>
	
	
	
	<table width="100%">
	<tbody><tr valign="top">
		<td class="tiny-text" align="left">
		    <a id="ctl00_PermaLink" 
href="http://www.codeproject.com/script/Articles/Article.aspx?aid=10861">PermaLink</a>
 | 
			<a id="ctl00_PrivacyLink" 
href="http://www.codeproject.com/info/privacy.aspx">Privacy</a> |
			<a id="ctl00_TermsOfUseLink" 
href="http://www.codeproject.com/info/TermsOfUse.aspx">Terms of Use</a>
			<br>Last Updated: 30 Jun 2005<br>
			Editor: <a id="ctl00_ArticleEditor" 
href="http://www.codeproject.com/script/Membership/View.aspx?mid=28970">Smitha
 Vijayan</a><br>
		</td>
		<td class="tiny-text" valign="top" align="right">
			Copyright 2005 by Kazim Sardar Mehdi<br>Everything else
			Copyright © <a href="mailto:webmaster@codeproject.com">CodeProject</a>,
 1999-2010 <br>
			Web12 |
			<a id="ctl00_AdvertiseLink" 
href="http://www.codeproject.com/info/MediaKit.aspx">Advertise on the 
Code Project </a>
		</td>
	</tr>
	
	</tbody></table>
	
	<center>
		
	</center>

</div>
</div>	
	
<div>


</div>

<br>
<script type="text/javascript" language="Javascript" src="ImageSaveInDataBase.aspx_files/oncopy.js"></script>
<script type="text/javascript" language="Javascript" src="ImageSaveInDataBase.aspx_files/TogglePre.js"></script>
<script type="text/javascript" language="Javascript" src="ImageSaveInDataBase.aspx_files/jquery-1.js"></script><script type="text/javascript">//<![CDATA[
if (typeof jQuery == 'undefined') {
    document.write(unescape("%3Cscript src='/script/JS/jquery-1.3.2.min.js' type='text/javascript' %3E%3C/script%3E"));
}//]]></script>
<script type="text/javascript" language="Javascript" src="ImageSaveInDataBase.aspx_files/JobsSummaryRetriever.js"></script>
<script type="text/javascript" language="Javascript" src="ImageSaveInDataBase.aspx_files/addto.js"></script>
<script type="text/javascript" language="Javascript" src="ImageSaveInDataBase.aspx_files/ShortCuts.js"></script>
<script type="text/javascript" language="Javascript">//<![CDATA[
if (document.all) try {window.attachEvent("oncopy",copyCode);}catch(e){};
var e=document;
if(e){if(document.all)try{e.attachEvent('onkeydown',LK);}catch(ex){} 
else e.addEventListener('keydown',LK, false);}

var e=document;
if(e){if(document.all)try{e.attachEvent('onkeyup',LK);}catch(ex){} 
else e.addEventListener('keyup',LK, false);}

var e=document;
if(e){if(document.all)try{e.attachEvent('onblur',LK);}catch(ex){} 
else e.addEventListener('blur',LK, false);}

var e=document.getElementById('ctl00_TopNavBar_Lounge');
if(e){if(document.all)try{e.attachEvent('onclick',LC);}catch(ex){} 
else e.addEventListener('click',LC, false);}

var e=document.getElementById('ctl00_TopNavBar_Soapbox');
if(e){if(document.all)try{e.attachEvent('onclick',LC);}catch(ex){} 
else e.addEventListener('click',LC, false);}

$(document).ready(function() {RetrieveJobsSummary('Th',10861,2,127,"11,29,38,81,93,94,117,118,133,153");});
var socialLinks = new social();
socialLinks.PlaceholderId="ATD";socialLinks.ObjectId=10861;
socialLinks.ObjectTypeId=2;
socialLinks.addtoMethod=1;
socialLinks.Horizontal=false;
socialLinks.Showname=true;
socialLinks.setupLinks("socialLinks", document.location.href,escape(document.title), 100, 0, "small-text Bold", "AddTo");
socialLinks.setupMenu();
$(function() {
  var postData = '{ "impressions": [{"AdvertisementId":13980,"CreativeId":12521,"IsCrawler":false,"ObjectId":10861,"ObjectTypeId":2},{"AdvertisementId":13169,"CreativeId":11649,"IsCrawler":false,"ObjectId":10861,"ObjectTypeId":2},{"AdvertisementId":10335,"CreativeId":10188,"IsCrawler":false,"ObjectId":10861,"ObjectTypeId":2},{"AdvertisementId":13816,"CreativeId":12447,"IsCrawler":false,"ObjectId":10861,"ObjectTypeId":2},{"AdvertisementId":13817,"CreativeId":12449,"IsCrawler":false,"ObjectId":10861,"ObjectTypeId":2}]}';
                $.ajax({
                    type: 'POST',
                    cache: false,
                    url: '/script/AdServe/WebServices/AdServices.aspx/RecordImpressions',
                    data: postData,
                    contentType: 'application/json; charset=utf-8',
                    dataType: 'json',success: function(msg) {
                    }
                });});

$( function() { $('#ctl00_TopAd').attr('src','/script/AdServe/ServeImg.aspx?C=False&adcrid=12521&adid=13980&obid=10861&obtid=2' );});
$( function() { $('#ctl00_LeftHandAd').attr('src','/script/AdServe/ServeImg.aspx?C=False&adcrid=10188&adid=10335&obid=10861&obtid=2' );});
$(function() { $("#ctl00_TowerAd").html(unescape("%3cIFRAME%20src=%22/script/AdServe/ServeHtml.aspx?C=False&adcrid=12447&adid=13816&obid=10861&obtid=2%22 frameborder=%220%22 scrolling=%22no%22 width=%22160px%22 height=%22600px%22%3e%3c/IFRAME%3e"));});
$(function() { $("#ctl00_AdWords").html(unescape("%3cIFRAME%20src=%22/script/AdServe/ServeHtml.aspx?C=False&adcrid=12449&adid=13817&obid=10861&obtid=2%22 frameborder=%220%22 scrolling=%22no%22 width=%22300px%22 height=%22250px%22%3e%3c/IFRAME%3e"));});
$('#ctl00_RateArticle_RateItemWrapper').css('display', '');
function ChkRtctl00_RateArticle(val, objId) {if (val<=2) {$('div[name=RateItem_' + objId + '] .RateComDiv').css("display","");}else $('div[name=RateItem_' + objId + '] .RateComDiv').css("display","none");}
$( function() { $('#ctl00_BottomAd').attr('src','/script/AdServe/ServeImg.aspx?C=False&adcrid=11649&adid=13169&obid=10861&obtid=2' );});

//]]>
</script>


<script type="text/javascript">
  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script><script src="ImageSaveInDataBase.aspx_files/ga.js" type="text/javascript"></script>
<script type="text/javascript">
if (typeof(_gat) != "undefined" && _gat)
{ 
	var pageTracker = _gat._getTracker("UA-1735123-1");
	pageTracker._setDomainName("www.codeproject.com");
	pageTracker._setSessionTimeout("1200"); // 20 mins
	pageTracker._initData();
	pageTracker._trackPageview();
}
</script>
</body></html>